Java Utililty Methods Timer Usage

List of utility methods to do Timer Usage

  1. HOME
  2. Java
  3. T
  4. Timer Usage

Description

The list of methods to do Timer Usage are organized into topic(s).

Method

int countWorkerPoolTimerThreads()
count Worker Pool Timer Threads
return countThreads(WORKER_POOL_TIMER);
Timer delayedExit(final int status, final long delay)
delayed Exit
Timer timer = new Timer();
timer.schedule(new TimerTask() {
 public void run() {
 System.exit(0);
}, delay);
return timer;
void exitSystemAfterTimeout(final long delay)
exit System After Timeout
new Timer().schedule(new TimerTask() {
 @Override
 public void run() {
 System.exit(1);
}, delay);
Timer getMinIdleTimer()
Get the Timer for checking keyedPool's idle count.
if (MIN_IDLE_TIMER == null) {
 MIN_IDLE_TIMER = new Timer(true);
return MIN_IDLE_TIMER;
Timer getQuickSearchTimer()
get Quick Search Timer
if (quickSearchTimer == null) {
 quickSearchTimer = new Timer("QuickSearchTimer", true);
return quickSearchTimer;
Timer getSlowTimer()
get Slow Timer
synchronized (TIMER_LOCK) {
 if (timerslow == null) {
 timerslow = new Timer();
 return timerslow;
Timer getTimer(String id)
get Timer
Timer timer = timerById.get(id);
if (null == timer) {
 timer = new Timer(true);
 timerById.put(id, timer);
return timer;
boolean mayNewTasksBeScheduled(Timer timer)
Checks whether new tasks can be scheduled, that is whether the time thread is still active.
try {
 timer.schedule(null, 0);
} catch (IllegalStateException ex) {
 return false;
} catch (NullPointerException ex) {
 return true;
return true;
...
void printLoadToConsole(int milliOffset)
Prints a spinning icon to the console
loading = true;
final Timer t = new Timer();
TimerTask task = new TimerTask() {
 int loop = 0;
 public void run() {
 if (loading) {
 loop++;
 if (loop == 1) {
...
void runRotateKeys()
run Rotate Keys
Timer timer = new Timer();
timer.schedule(new TimerTask() {
 @Override
 public void run() {
 System.out.println("Rotating keys...");
}, 2 * 60 * 1000, 2 * 60 * 1000); 


AltStyle によって変換されたページ (->オリジナル) /