Package com.iizix.timeout
Interface ITimeoutTask
- All Superinterfaces:
- ITimerTask
- All Known Implementing Classes:
- TimeoutTask
An interface for a registered timeout task that can be queried for timeout or canceled.
- Author:
- Christopher Mindus
- Method SummaryModifier and TypeMethodDescription- default boolean- cancel()Cancels the timer task.- booleanCancels the timeout task.- longGets the remaining time before timeout.- booleanReturns whether timeout notification has been called or not.- booleanVerifies if timeout has occurred.- Methods inherited from interface com.iizix.timeout.ITimerTask- getStartTime
- Method Details- getRemainingTimelong getRemainingTime()Gets the remaining time before timeout. This value just keeps on counting, even when the timeout has occurred or the task is stopped.- Returns:
- A time in milliseconds >= zero indicating the remaining timeout time, or < zero if the task has timed out. The return value is Long.MAX_VALUEif the timeout is indefinite.
 
- hasTimedOutboolean hasTimedOut()Verifies if timeout has occurred.- Returns:
- true if the task has timed out, false otherwise.
 
- hasNotifiedTimeoutboolean hasNotifiedTimeout()Returns whether timeout notification has been called or not.- Returns:
- true if the timeout task has been notified, false otherwise (e.g. task canceled).
 
- cancelTimeoutboolean cancelTimeout()Cancels the timeout task. This call can be done from any thread and will stop any timeout notification of- ITimeoutListener.onTimeout().- Returns:
- true for success, false if already canceled.
 
- canceldefault boolean cancel()Cancels the timer task. This call can be done from any thread and will stop any notification of the timer event.- Specified by:
- cancelin interface- ITimerTask
- Returns:
- true for success, false if already canceled.