jdk/src/share/classes/java/awt/EventQueue.java
Print this page
rev 5693 : 7192977: Issue in toolkit thread
Reviewed-by: skoivu, rupashka, art
*** 187,205 ****
public boolean isDispatchThreadImpl(EventQueue eventQueue) {
return eventQueue.isDispatchThreadImpl();
}
public void removeSourceEvents(EventQueue eventQueue,
Object source,
! boolean removeAllEvents) {
eventQueue.removeSourceEvents(source, removeAllEvents);
}
public boolean noEvents(EventQueue eventQueue) {
return eventQueue.noEvents();
}
public void wakeup(EventQueue eventQueue, boolean isShutdown) {
eventQueue.wakeup(isShutdown);
}
});
}
public EventQueue() {
for (int i = 0; i < NUM_PRIORITIES; i++) {
--- 187,211 ----
public boolean isDispatchThreadImpl(EventQueue eventQueue) {
return eventQueue.isDispatchThreadImpl();
}
public void removeSourceEvents(EventQueue eventQueue,
Object source,
! boolean removeAllEvents)
! {
eventQueue.removeSourceEvents(source, removeAllEvents);
}
public boolean noEvents(EventQueue eventQueue) {
return eventQueue.noEvents();
}
public void wakeup(EventQueue eventQueue, boolean isShutdown) {
eventQueue.wakeup(isShutdown);
}
+ public void invokeAndWait(Object source, Runnable r)
+ throws InterruptedException, InvocationTargetException
+ {
+ EventQueue.invokeAndWait(source, r);
+ }
});
}
public EventQueue() {
for (int i = 0; i < NUM_PRIORITIES; i++) {
*** 1231,1252 ****
* @see Toolkit#getSystemEventQueue
* @see #isDispatchThread
* @since 1.2
*/
public static void invokeAndWait(Runnable runnable)
! throws InterruptedException, InvocationTargetException {
if (EventQueue.isDispatchThread()) {
throw new Error("Cannot call invokeAndWait from the event dispatcher thread");
}
class AWTInvocationLock {}
Object lock = new AWTInvocationLock();
InvocationEvent event =
! new InvocationEvent(Toolkit.getDefaultToolkit(), runnable, lock,
! true);
synchronized (lock) {
Toolkit.getEventQueue().postEvent(event);
while (!event.isDispatched()) {
lock.wait();
--- 1237,1263 ----
* @see Toolkit#getSystemEventQueue
* @see #isDispatchThread
* @since 1.2
*/
public static void invokeAndWait(Runnable runnable)
! throws InterruptedException, InvocationTargetException
! {
! invokeAndWait(Toolkit.getDefaultToolkit(), runnable);
! }
+ static void invokeAndWait(Object source, Runnable runnable)
+ throws InterruptedException, InvocationTargetException
+ {
if (EventQueue.isDispatchThread()) {
throw new Error("Cannot call invokeAndWait from the event dispatcher thread");
}
class AWTInvocationLock {}
Object lock = new AWTInvocationLock();
InvocationEvent event =
! new InvocationEvent(source, runnable, lock, true);
synchronized (lock) {
Toolkit.getEventQueue().postEvent(event);
while (!event.isDispatched()) {
lock.wait();