org.egothor.distributor
Interface Distributor<T>

All Known Implementing Classes:
MTE, STE

public interface Distributor<T>

The Distributor interface should be implemented by any class that distributes a Task to a Sequence of objects, which are taken as recipients.

A second important functionality is the distribution of a Request until it is fulfilled (Request.isDone()).

Note: the Enumeration may be replaced by java.util.Set

Author:
Leo Galambos

Method Summary
 void allow()
          If this Distributor is stopped, restart it.
 void forEach(Sequence<T> to, Task<T> task)
          Put the task to all acting (inner) structures.
 void iterate(Sequence<T> to, Request<T> task)
          Iterate through the Enumeration (in Egothor's case the active (inner) barrels) in a predefined and constant order and try to give them the request until one of them fulfills it.
 void stop()
          Do not accept new activities.
 

Method Detail

forEach

void forEach(Sequence<T> to,
             Task<T> task)
Put the task to all acting (inner) structures. It may be freely distributed as iterate does or in multithread mode. It is up to the implementation.

Parameters:
to - the recipients that will perform the work
task - the task

iterate

void iterate(Sequence<T> to,
             Request<T> task)
Iterate through the Enumeration (in Egothor's case the active (inner) barrels) in a predefined and constant order and try to give them the request until one of them fulfills it.

Parameters:
to - the recipients that will perform the work
task - the task

stop

void stop()
Do not accept new activities. Wait some time if any actions are pending, and then cancel everything not ending gracefully.


allow

void allow()
If this Distributor is stopped, restart it.