public interface Timeout
reportOneStepProgress()
. This information may be used by the policy to
make a decision. Once the policy decides to end the execution, it will call all
handlers registered through registerCallback(Runnable)
. This will happen
asynchronously.
A timeout must be initialised through init()
exactly once before it is
used.
Modifier and Type | Method and Description |
---|---|
void |
init()
Initialises the timeout object.
|
boolean |
isReached()
Determines whether the timeout is reached.
|
void |
registerCallback(Runnable callback)
Registers
callback to be run once the timeout is reached. |
void |
reportOneStepProgress()
Reports one step of progress to the policy.
|
void |
unregisterCallback(Runnable callback)
Removes
callback from the set of callbacks to be run once the timeout is
reached. |
boolean isReached()
true
, it will return true
on all further ivocations.true
if the timeout is reached; false
otherwise.void reportOneStepProgress()
void init()
void registerCallback(Runnable callback)
callback
to be run once the timeout is reached.callback
- A Runnable
object.