AWT-EventQueue-0
is your event dispatch thread, and it is indeed blocked reading from a serial port via RXTX
a socket via hsqldb
. You should use SwingWorker
, as suggested by @Kumar. Examples may be found here and here. I found it helpful to examine such examples in a profiler for study.
Thread-6
and Thread-7
appear to belong to your application as instances of Threads.ThreadHorloge
in posO2
. Regarding thread names:
Every thread has a name for identification purposes. More than one thread may have the same name. If a name is not specified when a thread is created, a new name is generated for it.
Note that SwingWorker
and Executors
typically include the text pool-n, where n is a sequence number.
Addendum: My EDT is in a RUNNABLE
state, so from the code I pasted where do you figure out that it's blocked; and where do you find that the reading via RXTX is the blocking cause?
Sorry, my mistake; corrected above. The EDT isn't BLOCKED
in the Thread.STATE
sense of waiting for a monitor lock; it's blocked in the sense that it's waiting for the database to respond, at least long enough to be seen atop the call stack when you send the -QUIT
signal. Neither serial nor network operations should be scheduled on the EDT.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…