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

Discussion in 'Java' started by Cherukan, May 24, 2007.

  1. Cherukan

    Cherukan Guest

    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
     
    Cherukan, May 24, 2007
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Mark Bram
    Replies:
    2
    Views:
    6,492
    Robert Mark Bram
    Dec 11, 2003
  2. Replies:
    9
    Views:
    31,571
    sameer.rede
    Sep 4, 2007
  3. Msj121
    Replies:
    0
    Views:
    1,388
    Msj121
    Sep 22, 2006
  4. javadev
    Replies:
    5
    Views:
    14,045
    javadev
    Nov 16, 2006
  5. Cherukan
    Replies:
    8
    Views:
    4,999
    Cherukan
    May 25, 2007
  6. muttley
    Replies:
    5
    Views:
    1,989
    Martin Gregorie
    Aug 23, 2007
  7. vysh
    Replies:
    3
    Views:
    3,010
    Roedy Green
    Sep 26, 2007
  8. Replies:
    2
    Views:
    839
Loading...