src/share/classes/java/awt/WaitDispatchSupport.java
Print this page
*** 106,116 ****
this.dispatchThread = dispatchThread;
this.extCondition = extCond;
this.condition = new Conditional() {
@Override
public boolean evaluate() {
! if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("evaluate(): blockingEDT=" + keepBlockingEDT.get() +
", blockingCT=" + keepBlockingCT.get());
}
boolean extEvaluate =
(extCondition != null) ? extCondition.evaluate() : true;
--- 106,116 ----
this.dispatchThread = dispatchThread;
this.extCondition = extCond;
this.condition = new Conditional() {
@Override
public boolean evaluate() {
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("evaluate(): blockingEDT=" + keepBlockingEDT.get() +
", blockingCT=" + keepBlockingCT.get());
}
boolean extEvaluate =
(extCondition != null) ? extCondition.evaluate() : true;
*** 163,173 ****
/**
* @inheritDoc
*/
@Override
public boolean enter() {
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("enter(): blockingEDT=" + keepBlockingEDT.get() +
", blockingCT=" + keepBlockingCT.get());
}
if (!keepBlockingEDT.compareAndSet(false, true)) {
--- 163,173 ----
/**
* @inheritDoc
*/
@Override
public boolean enter() {
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("enter(): blockingEDT=" + keepBlockingEDT.get() +
", blockingCT=" + keepBlockingCT.get());
}
if (!keepBlockingEDT.compareAndSet(false, true)) {
*** 190,204 ****
// 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() {
--- 190,204 ----
// 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.Level.FINEST)) {
log.finest("On dispatch thread: " + dispatchThread);
}
if (interval != 0) {
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("scheduling the timer for " + interval + " ms");
}
timer.schedule(timerTask = new TimerTask() {
@Override
public void run() {
*** 211,221 ****
// 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
--- 211,221 ----
// 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.Level.FINE)) {
log.fine("Dispose current SequencedEvent: " + currentSE);
}
currentSE.dispose();
}
// In case the exit() method is called before starting
*** 229,239 ****
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);
--- 229,239 ----
run.run();
return null;
}
});
} else {
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("On non-dispatch thread: " + currentThread);
}
synchronized (getTreeLock()) {
if (filter != null) {
dispatchThread.addEventFilter(filter);
*** 255,269 ****
((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);
--- 255,269 ----
((extCondition != null) ? extCondition.evaluate() : true))
{
getTreeLock().wait();
}
}
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("waitDone " + keepBlockingEDT.get() + " " + keepBlockingCT.get());
}
} catch (InterruptedException e) {
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("Exception caught while waiting: " + e);
}
} finally {
if (filter != null) {
dispatchThread.removeEventFilter(filter);
*** 282,292 ****
/**
* @inheritDoc
*/
public boolean exit() {
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("exit(): blockingEDT=" + keepBlockingEDT.get() +
", blockingCT=" + keepBlockingCT.get());
}
if (keepBlockingEDT.compareAndSet(true, false)) {
wakeupEDT();
--- 282,292 ----
/**
* @inheritDoc
*/
public boolean exit() {
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("exit(): blockingEDT=" + keepBlockingEDT.get() +
", blockingCT=" + keepBlockingCT.get());
}
if (keepBlockingEDT.compareAndSet(true, false)) {
wakeupEDT();
*** 309,319 ****
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));
}
--- 309,319 ----
log.fine("Wake up EDT done");
}
};
private void wakeupEDT() {
! if (log.isLoggable(PlatformLogger.Level.FINEST)) {
log.finest("wakeupEDT(): EDT == " + dispatchThread);
}
EventQueue eq = dispatchThread.getEventQueue();
eq.postEvent(new PeerEvent(this, wakingRunnable, PeerEvent.PRIORITY_EVENT));
}