src/share/classes/java/awt/WaitDispatchSupport.java

Print this page

        

*** 163,174 **** --- 163,176 ---- /** * @inheritDoc */ @Override public boolean enter() { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("enter(): blockingEDT=" + keepBlockingEDT.get() + ", blockingCT=" + keepBlockingCT.get()); + } if (!keepBlockingEDT.compareAndSet(false, true)) { log.fine("The secondary loop is already running, aborting"); return false; }
*** 188,200 **** --- 190,206 ---- // dispatch thread, start a new event pump; if we're // on any other thread, call wait() on the treelock Thread currentThread = Thread.currentThread(); if (currentThread == dispatchThread) { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("On dispatch thread: " + dispatchThread); + } if (interval != 0) { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("scheduling the timer for " + interval + " ms"); + } timer.schedule(timerTask = new TimerTask() { @Override public void run() { if (keepBlockingEDT.compareAndSet(true, false)) { wakeupEDT();
*** 205,215 **** --- 211,223 ---- // Dispose SequencedEvent we are dispatching on the the current // AppContext, to prevent us from hang - see 4531693 for details SequencedEvent currentSE = KeyboardFocusManager. getCurrentKeyboardFocusManager().getCurrentSequencedEvent(); if (currentSE != null) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("Dispose current SequencedEvent: " + currentSE); + } currentSE.dispose(); } // In case the exit() method is called before starting // new event pump it will post the waking event to EDT. // The event will be handled after the the new event pump
*** 221,231 **** --- 229,241 ---- run.run(); return null; } }); } else { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("On non-dispatch thread: " + currentThread); + } synchronized (getTreeLock()) { if (filter != null) { dispatchThread.addEventFilter(filter); } try {
*** 245,257 **** --- 255,271 ---- ((extCondition != null) ? extCondition.evaluate() : true)) { getTreeLock().wait(); } } + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("waitDone " + keepBlockingEDT.get() + " " + keepBlockingCT.get()); + } } catch (InterruptedException e) { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("Exception caught while waiting: " + e); + } } finally { if (filter != null) { dispatchThread.removeEventFilter(filter); } }
*** 268,279 **** --- 282,295 ---- /** * @inheritDoc */ public boolean exit() { + if (log.isLoggable(PlatformLogger.FINE)) { log.fine("exit(): blockingEDT=" + keepBlockingEDT.get() + ", blockingCT=" + keepBlockingCT.get()); + } if (keepBlockingEDT.compareAndSet(true, false)) { wakeupEDT(); return true; } return false;
*** 293,302 **** --- 309,320 ---- log.fine("Wake up EDT done"); } }; private void wakeupEDT() { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("wakeupEDT(): EDT == " + dispatchThread); + } EventQueue eq = dispatchThread.getEventQueue(); eq.postEvent(new PeerEvent(this, wakingRunnable, PeerEvent.PRIORITY_EVENT)); } }