Reaction Home

com.zynaptic.reaction
Interface DeferredSplitter<T>

Type Parameters:
T - This type parameter specifies the type of data which may be passed into the deferred splitter by the input deferred event object.

public interface DeferredSplitter<T>

Defines a splitter for deferred event callback chains. This allows a single deferred event to trigger multiple parallel callback chains. The data object passed into the splitter will be passed up to each of the parallel callback chains in strict sequence - observing the ordering with which the deferrable callbacks were added to the deferred splitter object. Callback chains should not usually make any change to the state of the data parameter object. Therefore, when using callback chain splitters it is good practice to make the data parameter object immutable in order to enforce the correct behaviour.


Method Summary
 void addInputDeferred(Deferred<T> deferred)
          Attaches the input deferred event object.
 Deferred<T> getOutputDeferred()
          Obtains a handle on a unique output deferred event object.
 

Method Detail

addInputDeferred

void addInputDeferred(Deferred<T> deferred)
                      throws DeferredTerminationException
Attaches the input deferred event object. This method is used to attach the input deferred event object which will be used to trigger the callbacks in the deferred callback splitter. The callback chain associated with the input deferred event object will automatically be terminated by the splitter. This method should only be called once for each splitter object.

Parameters:
deferred - This is the input deferred event object which will be used to trigger the callbacks on the splitter.
Throws:
DeferredTerminationException - This exception will be thrown if an attempt is made to add more than one deferrable event object as an input. It will also be generated if the callback chain associated with the deferred event object has already been terminated.

getOutputDeferred

Deferred<T> getOutputDeferred()
Obtains a handle on a unique output deferred event object. This method is used to obtain a handle on a unique output deferred event object within the callback chain splitter. Each time this method is called a new object implementing the Deferred interface is added to the splitter and returned to the caller.

Returns:
Returns a deferred event object which will have its callbacks or errbacks executed when the splitter is triggered by its input callback chain.

Reaction Home