コード例 #1
1
  public synchronized void dispose() {
    List<SchedulerListener> l = listeners;
    listeners = null;

    if (l != null) {
      boolean cont = true;
      while (cont) {
        synchronized (l) {
          int queueSize = getQueueSize();
          if (queueSize == 0) {
            cont = false;
          } else {
            try {
              l.wait();
            } catch (InterruptedException ex) {
              // Ignore!
            }
          }
        }
      }

      synchronized (l) {
        l.clear();
      }
    }
  }
コード例 #2
0
 public void removeSchedulerListener(SchedulerListener schedulerListener) {
   if (schedulerListener != null) {
     List<SchedulerListener> l = listeners;
     if (l != null) {
       synchronized (l) {
         l.remove(schedulerListener);
       }
     }
   }
 }
コード例 #3
0
 public void addSchedulerListener(SchedulerListener schedulerListener) {
   if (schedulerListener != null) {
     List<SchedulerListener> l = listeners;
     if (l != null) {
       synchronized (l) {
         l.add(schedulerListener);
       }
     }
   }
 }