Package net.sf.ehcache.util
Class FailSafeTimer
- java.lang.Object
-
- net.sf.ehcache.util.FailSafeTimer
-
public class FailSafeTimer extends java.lang.ObjectA 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
Constructors Constructor Description FailSafeTimer(java.lang.String name)Constructor accepting a name for the timer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()If the runtime environment restricts thread creation, this method does nothing.intpurge()If the runtime environment restricts thread creation, this method does nothing.voidschedule(java.util.TimerTask task, long delay)If the runtime environment restricts thread creation, the task is run inline for only one time.voidschedule(java.util.TimerTask task, long delay, long period)If the runtime environment restricts thread creation, the task is run inline for only one time.voidschedule(java.util.TimerTask task, java.util.Date time)If the runtime environment restricts thread creation, the task is run inline for only one time.voidschedule(java.util.TimerTask task, java.util.Date firstTime, long period)If the runtime environment restricts thread creation, the task is run inline for only one time.voidscheduleAtFixedRate(java.util.TimerTask task, long delay, long period)If the runtime environment restricts thread creation, the task is run inline for only one time.voidscheduleAtFixedRate(java.util.TimerTask task, java.util.Date firstTime, long period)If the runtime environment restricts thread creation, the task is run inline for only one time.
-
-
-
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(java.util.TimerTask task, java.util.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(java.util.TimerTask task, java.util.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(java.util.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(java.util.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(java.util.TimerTask task, java.util.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(java.util.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)
-
-