Package com.iizix.timeout
Interface ITimerEngine
public interface ITimerEngine
The timer engine handles timeouts and scheduled events.
It can be used to register a timeout for a task that runs in a thread. When timeout is reached, the method ITimeoutListener.onTimeout() is called from another thread, informing the running thread of this timeout. It is up to the running thread to take appropriate action.
It can also handle a scheduled periodic event notification that also runs in a thread.
- Author:
- Christopher Mindus
- Method SummaryModifier and TypeMethodDescription- void- dispose()Disposes of the engine and disposes of all pending scheduled timers and timeouts.- booleanChecks if engine is disposed or not.- registerTimeout- (long timeout, String description, ITimeoutListener listener) Registers a new timeout for processing.
- Method Details- registerTimeoutRegisters a new timeout for processing.- Parameters:
- timeout- The timeout in milliseconds, -1 for indefinite.
- description- The description of the timeout operation, null for none.
- listener- The listener for timeout notification.
- Throws:
- NullPointerException- If the- listeneris- null.
- IllegalStateException- If the engine has been disposed of.
 
- disposevoid dispose()Disposes of the engine and disposes of all pending scheduled timers and timeouts.
- isDisposedboolean isDisposed()Checks if engine is disposed or not.- Returns:
- true if disposed, false otherwise.