ehcache

net.sf.ehcache.util
Class FailSafeTimer

java.lang.Object
  extended by net.sf.ehcache.util.FailSafeTimer

public class FailSafeTimer
extends Object

A fail-safe timer in the sense that if the runtime environment restricts creating new threads, it doesn't blow up with an exception. TimerTasks that are scheduled will run at least once (inline when they are scheduled) if creating threads is not allowed. For example, Google App Engine does not allow creation of new threads.

Clients should not use this as a general purpose timing service. To do so could interfere with the running of the Cache.

Since:
1.7
Author:
Abhishek Sanoujam

Constructor Summary
FailSafeTimer(String name)
          Constructor accepting a name for the timer.
 
Method Summary
 void cancel()
          If the runtime environment restricts thread creation, this method does nothing.
 int purge()
          If the runtime environment restricts thread creation, this method does nothing.
 void schedule(TimerTask task, Date time)
          If the runtime environment restricts thread creation, the task is run inline for only one time.
 void schedule(TimerTask task, Date firstTime, long period)
          If the runtime environment restricts thread creation, the task is run inline for only one time.
 void schedule(TimerTask task, long delay)
          If the runtime environment restricts thread creation, the task is run inline for only one time.
 void schedule(TimerTask task, long delay, long period)
          If the runtime environment restricts thread creation, the task is run inline for only one time.
 void scheduleAtFixedRate(TimerTask task, Date firstTime, long period)
          If the runtime environment restricts thread creation, the task is run inline for only one time.
 void scheduleAtFixedRate(TimerTask task, long delay, long period)
          If the runtime environment restricts thread creation, the task is run inline for only one time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FailSafeTimer

public FailSafeTimer(String name)
Constructor accepting a name for the timer. The scheduling thread is created as a daemon

Parameters:
name -
Method Detail

cancel

public void cancel()
If the runtime environment restricts thread creation, this method does nothing.

See Also:
Timer.cancel()

purge

public int purge()
If the runtime environment restricts thread creation, this method does nothing.

See Also:
Timer.purge()

schedule

public void schedule(TimerTask task,
                     Date firstTime,
                     long period)
If the runtime environment restricts thread creation, the task is run inline for only one time. No further repeated execution happens for the task

See Also:
Timer.schedule(java.util.TimerTask, java.util.Date, long)

schedule

public void schedule(TimerTask task,
                     Date time)
If the runtime environment restricts thread creation, the task is run inline for only one time. No further repeated execution happens for the task

See Also:
Timer.schedule(java.util.TimerTask, java.util.Date)

schedule

public void schedule(TimerTask task,
                     long delay,
                     long period)
If the runtime environment restricts thread creation, the task is run inline for only one time. No further repeated execution happens for the task

See Also:
Timer.schedule(java.util.TimerTask, long, long)

schedule

public void schedule(TimerTask task,
                     long delay)
If the runtime environment restricts thread creation, the task is run inline for only one time. No further repeated execution happens for the task

See Also:
Timer.schedule(java.util.TimerTask, long)

scheduleAtFixedRate

public void scheduleAtFixedRate(TimerTask task,
                                Date firstTime,
                                long period)
If the runtime environment restricts thread creation, the task is run inline for only one time. No further repeated execution happens for the task

See Also:
Timer.scheduleAtFixedRate(java.util.TimerTask, java.util.Date, long)

scheduleAtFixedRate

public void scheduleAtFixedRate(TimerTask task,
                                long delay,
                                long period)
If the runtime environment restricts thread creation, the task is run inline for only one time. No further repeated execution happens for the task

See Also:
Timer.scheduleAtFixedRate(java.util.TimerTask, long, long)

ehcache

Copyright 2001-2015, Terracotta, Inc.