T
- This type parameter specifies the type of data which will be emitted
by the deferred event object at the end of the current callback
chain.public interface Deferred<T>
Modifier and Type | Method and Description |
---|---|
<U> Deferred<U> |
addDeferrable(Deferrable<T,U> deferrable)
Attaches a deferrable object to the deferred event.
|
<U> Deferred<U> |
addDeferrable(Deferrable<T,U> deferrable,
boolean terminal)
Attaches a deferrable object to the deferred event.
|
void |
callback(T data)
Issues a deferred callback.
|
Deferred<T> |
cancelTimeout()
Cancels the timeout associated with the deferred event.
|
T |
defer()
Performs a synchronous wait for the deferred callback results.
|
void |
discard()
Discards the deferred event.
|
void |
errback(java.lang.Exception error)
Issues an error callback.
|
Deferred<T> |
makeRestricted()
Convert the deferred interface to restricted capability.
|
Deferred<T> |
setTimeout(int msTimeout)
Sets the timeout associated with the deferred event.
|
Deferred<T> |
terminate()
Terminates a deferred callback chain.
|
void callback(T data) throws RestrictedCapabilityException, DeferredTriggeredException
ReactorNotRunningException
instead.data
- This parameter is a data object of type T
which is
used to pass data back to the deferrable object.RestrictedCapabilityException
- This runtime exception is thrown if an attempt is made to call
this method on a deferred event object reference with restricted
capability.DeferredTriggeredException
- This runtime exception is raised if the deferred event has
already been triggered via the callback
or errback
methods.void errback(java.lang.Exception error) throws RestrictedCapabilityException, DeferredTriggeredException
ReactorNotRunningException
instead.error
- The error parameter passes an exception object which can be used
to identify the error condition.RestrictedCapabilityException
- This exception is thrown if an attempt is made to call this
method on a deferred event object reference with restricted
capability.DeferredTriggeredException
- This runtime exception is raised if the deferred event has
already been triggered via the callback
or errback
methods.<U> Deferred<U> addDeferrable(Deferrable<T,U> deferrable, boolean terminal) throws DeferredTerminationException
U
- This type parameter specifies the data type which is returned by
the onCallback
and
onErrback
methods of the deferrable object which is being added to the
callback chain.deferrable
- This is the deferrable object which is to be added to the callback
chain. It may be a link deferrable or a terminal deferrable,
depending on the state of the terminal
parameter.terminal
- This flag is set to indicate that this deferrable should terminate
the callback chain. Once a terminal deferrable has been added no
further deferrables can be added.DeferredTerminationException
- This runtime exception is raised if the deferred callback chain
has already been terminated by adding a terminal deferrable.<U> Deferred<U> addDeferrable(Deferrable<T,U> deferrable) throws DeferredTerminationException
U
- This type parameter specifies the data type which is returned by
the onCallback
and
onErrback
methods of the deferrable object which is being added to the
callback chain.deferrable
- This is the deferrable object which is to be added to the callback
chain.DeferredTerminationException
- This runtime exception is raised if the deferred callback chain
has already been terminated by adding a terminal deferrable.Deferred<T> terminate() throws DeferredTerminationException
Deferred
interface,
allowing fluent-style callback chain termination.DeferredTerminationException
- This runtime exception is raised if the deferred callback chain
has already been terminated, or if no deferrable callback
handlers have previously been added to the callback chain.Deferred<T> setTimeout(int msTimeout) throws ReactorNotRunningException
DeferredTimedOutException
as the parameter. By default no timeout
is set. If this function is called multiple times, the most recently
requested timeout is used. A timeout value of zero or less may be used to
force an immediate timeout.msTimeout
- This is the timeout to be used by the deferred event, specified as
an integer number of milliseconds.Deferred
interface,
allowing fluent-style timeout assignments.ReactorNotRunningException
- This exception is thrown if an attempt is made to set a deferred
timeout when the reactor is not running.Deferred<T> cancelTimeout()
Deferred
interface,
allowing fluent-style timeout assignments.void discard() throws DeferredTerminationException
DeferredTerminationException
- This runtime exception is raised if the deferred callback chain
has already been terminated by adding a terminal deferrable.Deferred<T> makeRestricted()
callback
and errback
methods are protected from unauthorised use.Deferred
interface with
restricted capability.T defer() throws DeferredContextException, java.lang.Exception
DeferredContextException
- This exception will be thrown if an attempt is made to call this
method from within the context of the main reactor thread.java.lang.Exception
- This arbitrary exception will be thrown if an error condition has
been passed back via the deferred errback chain. The types of
exception which may be thrown are dependent on the error
conditions which may occur for a given application call.