org.egothor.distributor
Class STE<T>

java.lang.Object
  extended by org.egothor.distributor.STE<T>
All Implemented Interfaces:
Distributor<T>
Direct Known Subclasses:
MTE

public class STE<T>
extends java.lang.Object
implements Distributor<T>

An STE distributes all jobs sequentially, that is, the recipients of jobs are always iterated one by one.

Author:
Leo Galambos

Field Summary
protected  boolean stopped
          Is the thread stopped?
 
Constructor Summary
STE()
           
 
Method Summary
 void allow()
          Restart the thread.
 void forEach(Sequence<T> to, Task<T> task)
          Iterate through the Enumeration and give the element the task.
 void iterate(Sequence<T> to, Request<T> task)
          Iterate through the Enumeration and give the element the task, if not already completed..
 void stop()
          Stop the thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stopped

protected boolean stopped
Is the thread stopped?

Constructor Detail

STE

public STE()
Method Detail

forEach

public void forEach(Sequence<T> to,
                    Task<T> task)
Iterate through the Enumeration and give the element the task.

Specified by:
forEach in interface Distributor<T>
Parameters:
to - the Enumeration of recipients
task - the task

iterate

public void iterate(Sequence<T> to,
                    Request<T> task)
Iterate through the Enumeration and give the element the task, if not already completed.. If the thread is stopped the method will not execute.

Specified by:
iterate in interface Distributor<T>
Parameters:
to - the Enumeration of recipients
task - the task

stop

public void stop()
Stop the thread.

Specified by:
stop in interface Distributor<T>

allow

public void allow()
Restart the thread.

Specified by:
allow in interface Distributor<T>