• Post Reply Bookmark Topic Watch Topic
  • New Topic

EventQueue.push/pop behavior changed?  RSS feed

 
Prabhakar Reddy Bokka
Ranch Hand
Posts: 198
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are using EventQueue.push() to replace with a new AWT EventQueue. It was working fine till JDK 6.

But it seems the EventQueue.push/pop behavior changed from JDK 7 and later versions. Checked in the JDK source code, it changed a lot. But there was no update to the Documentation. So, i am assuming there should not be any changes to its behavior.

But it was not working as expected.

Below is the sample code i created for testing. SwingUtilities.isEventDispatchThread() returns different values in JDK 6 and JDK 7 after EventQueue.push/pop method calls.


Output of this code is different in JDK 6 and JDK 7.
But as per the documentation in the EventQueue class, there are no changes in the behavior.

Can someone help me to understand how to handle the AWT EventQueue and EventDispatchThread in JDK 7 and later versions?

 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know myself, but you need to tell us the details please, e.g. what did you expect to happen, and what actually happened. That will make it easier for people to help you.
 
Prabhakar Reddy Bokka
Ranch Hand
Posts: 198
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EventQueue.pop() Stops dispatching events using this EventQueue.

SwingUtilities.isEventDispatchThread() should return false after the EventQueue.pop() called.

It works perfectly till JDK 1.6. But not working after JDK 7 and later versions. EventQueue.pop() is not stopping dispatching events.
As a result SwingUtilities.isEventDispatchThread() returning true even after EventQueue.pop() called.

My code is depening on EventQueue.push() to replace with new AWT-EventQueue, and EventQueue.pop() to stop dispatching events.

As both are not working from JDK 1.7, My code is broken in newer versions. It became a show stopper for my migration.

But there was no change to the API documentation of the class EventQueue EventQueue API

I checked the source code, the logic is completely changed. However i do not see the changes documented in the class.

To me, it seems a bug in JDK 1.7 and later versions.

Can anyone guide me how to resolve this issue?
 
Prabhakar Reddy Bokka
Ranch Hand
Posts: 198
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This issue got accepted as bug in JDK 7 and later versions. Targetted for the fix in JDK 9. Below is link to the bug details

http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8144759
 
Prabhakar Reddy Bokka
Ranch Hand
Posts: 198
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surprisingly, I came to know that Java Bug Database is not correct. oak...

Yes, we purchased Oracle support for resolution of the bug accepted by Oracle and displayed in Java Bug Database.

Now Oracle says this is not a bug and Java Bug Database is not correct/valid page... oak...

Oracle says EventQueue. push and pop behavior changed from Java 7.stopped support for multi threading. But never documented the same in JavaDoc.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!