net.sf.jaer.eventprocessing
Class TimeLimiter
java.lang.Object
java.util.Timer
net.sf.jaer.eventprocessing.TimeLimiter
public final class TimeLimiter
- extends java.util.Timer
This utility class allows setting a limiting time and
cheap checking for whether this time is exceeded. Event processors use
it to limit their own execution time. The caller initializes the
TimeLimiter and then calls to see if this time has been exceeded.
- Author:
- tobi
Constructor Summary |
TimeLimiter()
Creates a new time limiter with timeout ms. |
Methods inherited from class java.util.Timer |
cancel, purge, schedule, schedule, schedule, schedule, scheduleAtFixedRate, scheduleAtFixedRate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
timedOut
public volatile boolean timedOut
TimeLimiter
public TimeLimiter()
- Creates a new time limiter with timeout ms. Doesn't start it.
restart
public final void restart()
isTimedOut
public final boolean isTimedOut()
- check if timer expired
- Returns:
- true if time exceeded and timeout is enabled, otherwise false
getTimeLimitMs
public final int getTimeLimitMs()
setTimeLimitMs
public final void setTimeLimitMs(int timeLimitMs)
isEnabled
public final boolean isEnabled()
setEnabled
public final void setEnabled(boolean enabled)
- Set true to enable time timeouts, false to disable starting timer