java.lang.IllegalStateException: Deadlock risk: AWT tree lock acquired on a showing component..

C

Cherukan

Hi

I get this error when trying to popup a Swing dialog from a long-
running background thread.

java.lang.IllegalStateException: Deadlock risk: AWT tree lock acquired
on a
showing component when not on the event dispatch thread. (NOTE: do
*not* use
invokeAndWait to fix this assertion failure; that will increase the
chance of
actual deadlock.)
Thread name: task1-1438375310
at
java.awt.Component.assertThreadPolicyCompliance(Component.java:8566)
at java.awt.Component.getTreeLock(Component.java:871)
at java.awt.Component.getLocationOnScreen(Component.java:1651)

I realize this is happening because the current thread is not the
event thread.

But the background thread must get this input from the user to
proceed. Also the input
depends on the processing the thread has done upto this point, so it
cannot be
obtained before the thread has started. After the swing dialog has
closed, the thread
needs to resume its processing picking up where it left off.

As the message says, I cant use invokeAndWait.

Whats the 'safe' approach in such a case?

Thanks for your answers.

Cherukan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top