Updating swing components from an arbitrary thread Sexcyber chat

"Threading model" refers to the general system by which an application does things in parallel (or does not do things in parallel): managing threads (a core Java language feature), locks and synchronization, asynchronous tasks, scheduled tasks and timers, the GUI loop, etc.

It is difficult to describe the current state of threading in Net Beans precisely; no one is completely sure how it works.

Generally, packages using threading-related idioms in over 1% of code lines can be considered to be serious users of such semantics; this may not seem like a lot, but remember that such method calls require a lot more mental analysis than regular sequential code and can have large effects on the runtime behavior of other pieces of code.

(The Debugger module seems to show up so heavily at least in part because it appears to have copied and pasted , a complex threading utility class from the Open APIs, and added private patches.) Net Beans' bug tracking system records over 600 threading-related bugs, such as deadlocks and race conditions, some of which are have not yet been fixed, or were not found to be reproducible.

Casual inspection of matching lines confirms that most of the matches are really related to thread semantics.Normally we can just move operations into a separate thread e.g.: As you can see this is a very simple approach for thread programming in UI, you don’t need to block your flow and track the UI thread.You can just program in a way that seems sequential (top to bottom) but really uses multi-threading correctly without blocking the EDT.Mainly handled in the event thread; actions can choose to fork a task as needed.Action state updates usually happen in the event thread (not clear if this is guaranteed however). Document operations generally follow the Swing provisions: thread safe, with a read lock, and a Net Beans-added write lock (which may be only an isolated, not atomic, section—not clear). Document opening is complex and always runs asynchronously, even when called synchronously.

Leave a Reply