--- old/src/share/classes/sun/awt/SunToolkit.java 2012-08-17 13:46:25.064332000 +0400 +++ new/src/share/classes/sun/awt/SunToolkit.java 2012-08-17 13:46:23.820260900 +0400 @@ -544,7 +544,6 @@ postEvent(targetToAppContext(e.getSource()), pe); } - protected static final Lock flushLock = new ReentrantLock(); private static boolean isFlushingPendingEvents = false; /* @@ -552,7 +551,6 @@ * EventQueue yet. */ public static void flushPendingEvents() { - flushLock.lock(); try { // Don't call flushPendingEvents() recursively if (!isFlushingPendingEvents) { @@ -566,18 +564,6 @@ } } finally { isFlushingPendingEvents = false; - flushLock.unlock(); - } - } - - public static boolean isPostEventQueueEmpty() { - AppContext appContext = AppContext.getAppContext(); - PostEventQueue postEventQueue = - (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY); - if (postEventQueue != null) { - return postEventQueue.noEvents(); - } else { - return true; } } @@ -2112,17 +2098,10 @@ private EventQueueItem queueTail = null; private final EventQueue eventQueue; - // For the case when queue is cleared but events are not posted - private volatile boolean isFlushing = false; - PostEventQueue(EventQueue eq) { eventQueue = eq; } - public synchronized boolean noEvents() { - return queueHead == null && !isFlushing; - } - /* * Continually post pending AWTEvents to the Java EventQueue. The method * is synchronized to ensure the flush is completed before a new event @@ -2132,21 +2111,12 @@ * of EventQueue.postEvent() that uses pushPopLock, otherwise it could * potentially lead to deadlock */ - public void flush() { - EventQueueItem tempQueue; - synchronized (this) { - tempQueue = queueHead; - queueHead = queueTail = null; - isFlushing = true; - } - try { - while (tempQueue != null) { - eventQueue.postEvent(tempQueue.event); - tempQueue = tempQueue.next; - } - } - finally { - isFlushing = false; + public synchronized void flush() { + EventQueueItem tempQueue = queueHead; + queueHead = queueTail = null; + while (tempQueue != null) { + eventQueue.postEvent(tempQueue.event); + tempQueue = tempQueue.next; } }