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

Print this page




 207                         }
 208                     }
 209                 }, interval);
 210             }
 211             // Dispose SequencedEvent we are dispatching on the the current
 212             // AppContext, to prevent us from hang - see 4531693 for details
 213             SequencedEvent currentSE = KeyboardFocusManager.
 214                 getCurrentKeyboardFocusManager().getCurrentSequencedEvent();
 215             if (currentSE != null) {
 216                 if (log.isLoggable(PlatformLogger.Level.FINE)) {
 217                     log.fine("Dispose current SequencedEvent: " + currentSE);
 218                 }
 219                 currentSE.dispose();
 220             }
 221             // In case the exit() method is called before starting
 222             // new event pump it will post the waking event to EDT.
 223             // The event will be handled after the the new event pump
 224             // starts. Thus, the enter() method will not hang.
 225             //
 226             // Event pump should be privileged. See 6300270.
 227             AccessController.doPrivileged(new PrivilegedAction() {
 228                 public Object run() {
 229                     run.run();
 230                     return null;
 231                 }
 232             });
 233         } else {
 234             if (log.isLoggable(PlatformLogger.Level.FINEST)) {
 235                 log.finest("On non-dispatch thread: " + currentThread);
 236             }
 237             synchronized (getTreeLock()) {
 238                 if (filter != null) {
 239                     dispatchThread.addEventFilter(filter);
 240                 }
 241                 try {
 242                     EventQueue eq = dispatchThread.getEventQueue();
 243                     eq.postEvent(new PeerEvent(this, run, PeerEvent.PRIORITY_EVENT));
 244                     keepBlockingCT.set(true);
 245                     if (interval > 0) {
 246                         long currTime = System.currentTimeMillis();
 247                         while (keepBlockingCT.get() &&




 207                         }
 208                     }
 209                 }, interval);
 210             }
 211             // Dispose SequencedEvent we are dispatching on the the current
 212             // AppContext, to prevent us from hang - see 4531693 for details
 213             SequencedEvent currentSE = KeyboardFocusManager.
 214                 getCurrentKeyboardFocusManager().getCurrentSequencedEvent();
 215             if (currentSE != null) {
 216                 if (log.isLoggable(PlatformLogger.Level.FINE)) {
 217                     log.fine("Dispose current SequencedEvent: " + currentSE);
 218                 }
 219                 currentSE.dispose();
 220             }
 221             // In case the exit() method is called before starting
 222             // new event pump it will post the waking event to EDT.
 223             // The event will be handled after the the new event pump
 224             // starts. Thus, the enter() method will not hang.
 225             //
 226             // Event pump should be privileged. See 6300270.
 227             AccessController.doPrivileged(new PrivilegedAction<Object>() {
 228                 public Object run() {
 229                     run.run();
 230                     return null;
 231                 }
 232             });
 233         } else {
 234             if (log.isLoggable(PlatformLogger.Level.FINEST)) {
 235                 log.finest("On non-dispatch thread: " + currentThread);
 236             }
 237             synchronized (getTreeLock()) {
 238                 if (filter != null) {
 239                     dispatchThread.addEventFilter(filter);
 240                 }
 241                 try {
 242                     EventQueue eq = dispatchThread.getEventQueue();
 243                     eq.postEvent(new PeerEvent(this, run, PeerEvent.PRIORITY_EVENT));
 244                     keepBlockingCT.set(true);
 245                     if (interval > 0) {
 246                         long currTime = System.currentTimeMillis();
 247                         while (keepBlockingCT.get() &&