Closing a JOptionPane Causes a Deadlock in Java Swing
I have an application which开发者_开发知识库 runs OK at most sites. But one site, which is hosting the application on a Citrix Box appears to have a deadlock problem. I ran a profiler on the session and received a surprise. The statement causing the deadlock appears to be a statement which closes a JOptionPane dialogue box. Please see the enclosed display.
So I have three questions:
- Is my interpretation correct?
- Any idea of why this can happen.
- What can I do in code to prevent this from occurring?
Thank you in advance for your help.
Elliott
Swing is not thread-safe. Perhaps your app is calling Swing GUI methods from outside of the Event Dispatch Thread.
If you can reduce this to a minimal sample that still reproduces the problem, you will either 1) find the cause yourself in the process, or otherwise 2) end up with a much greater chance of getting help from someone else.
- Don't know, but if it is..
- Calling GUI methods (update the GUI) off the EDT.
- Call GUI methods on the EDT.
精彩评论