예제 #1
0
 public static void addPumpMessage(Display dpy, Runnable pumpMessage) {
   if (useMainThread) {
     return; // error ?
   }
   if (null == pumpMessagesTimer) {
     synchronized (MainThread.class) {
       if (null == pumpMessagesTimer) {
         pumpMessagesTimer = new Timer();
         pumpMessagesTimerTask =
             new TimerTask() {
               public void run() {
                 synchronized (pumpMessageDisplayMap) {
                   for (Iterator i = pumpMessageDisplayMap.values().iterator(); i.hasNext(); ) {
                     ((Runnable) i.next()).run();
                   }
                 }
               }
             };
         pumpMessagesTimer.scheduleAtFixedRate(
             pumpMessagesTimerTask, 0, defaultEDTPollGranularity);
       }
     }
   }
   synchronized (pumpMessageDisplayMap) {
     pumpMessageDisplayMap.put(dpy, pumpMessage);
   }
 }
예제 #2
0
 public static Runnable removePumpMessage(Display dpy) {
   synchronized (pumpMessageDisplayMap) {
     return (Runnable) pumpMessageDisplayMap.remove(dpy);
   }
 }