Netbeans multi-threaded programming

I looked through books / docs about NBP, but there is nothing direct about multithreaded programming in NBP. Is there anything special that needs attention regarding multithreading in NBP? So, if I want to create a multi-threaded NBP application, I just need to follow the usual practice of multi-threaded Java programming, right?

+3
source share
3 answers

The main thing to pay attention to will be RequestProcessor and RequestProcessor.Task. RequestProcessor is a thread pool; RequestProcessor.Task is a job.

, RequestProcessor, , ExecutorService JDK. , , JDK , . , , , , :

private static final RequestProcessor rp = new RequestProcessor(MyClass.class);
private RequestProcessor.Task task = rp.create(new Runnable() {
  public void run() {
    //...do some expensive parsing or similar
  }
});

public void keyPressed (KeyEvent ke) {
  task.schedule(200); // (re)schedule the task 200ms in the future;  if schedule() is called again, it will be postponed
}

Nodes API, , .

-, Swing, EventQueue.invokeLater(Runnable) EventQueue.invokeAndWait() - .

, , , NetBeans , : Mutex.EVENT.readAccess( Mutex.Action() {...})

+2

Java, ?

java Javacode NBP.

+1

, RCP NetBeans.

org.openide.util , RCP.

.. , , java.

, Progress UI api.

+1

Source: https://habr.com/ru/post/1793794/


All Articles