コード例 #1
0
ファイル: TimeScheduler2.java プロジェクト: jiwils/JGroups
 public String dumpTimerTasks() {
   StringBuilder sb = new StringBuilder();
   for (Entry entry : tasks.values()) {
     sb.append(entry.dump()).append("\n");
   }
   return sb.toString();
 }
コード例 #2
0
 public List<Long> values() {
   lockForRegularUsage();
   try {
     return new ArrayList<Long>(values.values());
   } finally {
     unlockForRegularUsage();
   }
 }
コード例 #3
0
 @Override
 public Snapshot getSnapshot() {
   lockForRegularUsage();
   try {
     return new WeightedSnapshot(values.values());
   } finally {
     unlockForRegularUsage();
   }
 }
コード例 #4
0
ファイル: TimeScheduler2.java プロジェクト: jiwils/JGroups
  /**
   * Stops the timer, cancelling all tasks
   *
   * @throws InterruptedException if interrupted while waiting for thread to return
   */
  public void stop() {
    stopRunner();

    java.util.List<Runnable> remaining_tasks = pool.shutdownNow();
    for (Runnable task : remaining_tasks) {
      if (task instanceof Future) {
        Future future = (Future) task;
        future.cancel(true);
      }
    }
    pool.getQueue().clear();
    try {
      pool.awaitTermination(Global.THREADPOOL_SHUTDOWN_WAIT_TIME, TimeUnit.MILLISECONDS);
    } catch (InterruptedException e) {
    }

    for (Entry entry : tasks.values()) entry.cancel();
    tasks.clear();
  }
コード例 #5
0
 public Collection<HistoryFileInfo> values() {
   return cache.values();
 }
コード例 #6
0
ファイル: TimeScheduler2.java プロジェクト: jiwils/JGroups
 /**
  * Returns the number of tasks currently in the timer
  *
  * @return The number of tasks currently in the timer
  */
 public int size() {
   int retval = 0;
   Collection<Entry> values = tasks.values();
   for (Entry entry : values) retval += entry.size();
   return retval;
 }