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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
dispose()
Disposes of the engine and disposes of all pending scheduled timers and timeouts.boolean
isDisposed()
Checks if engine is disposed or not.ITimeoutTask
registerTimeout(long timeout, java.lang.String description, ITimeoutListener listener)
Registers a new timeout for processing.
Method Detail
registerTimeout
ITimeoutTask registerTimeout(long timeout, java.lang.String description, ITimeoutListener listener)
Registers 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:
java.lang.NullPointerException
- If thelistener
isnull
.java.lang.IllegalStateException
- If the engine has been disposed of.
dispose
void dispose()
Disposes of the engine and disposes of all pending scheduled timers and timeouts.
isDisposed
boolean isDisposed()
Checks if engine is disposed or not.- Returns:
- true if disposed, false otherwise.