public String dumpTimerTasks() { StringBuilder sb = new StringBuilder(); for (Entry entry : tasks.values()) { sb.append(entry.dump()).append("\n"); } return sb.toString(); }
public List<Long> values() { lockForRegularUsage(); try { return new ArrayList<Long>(values.values()); } finally { unlockForRegularUsage(); } }
@Override public Snapshot getSnapshot() { lockForRegularUsage(); try { return new WeightedSnapshot(values.values()); } finally { unlockForRegularUsage(); } }
/** * 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(); }
public Collection<HistoryFileInfo> values() { return cache.values(); }
/** * 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; }