org.egothor.distributor
Class MTE<T>

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

public class MTE<T>
extends STE<T>

An MTE is a multithread distributor that uses a Pool for the management of threads.

Author:
Leo Galambos

Field Summary
 
Fields inherited from class org.egothor.distributor.STE
stopped
 
Constructor Summary
MTE()
          Constructor for the MTE object.
MTE(int threads)
          Construct an MTE object with the specified number of threads.
 
Method Summary
 void forEach(Sequence<T> to, Task<T> task)
          Put the task to all acting (inner) structures.
 int getThreads()
          Return the number of threads in this MTE.
 void setThreads(int threads)
          Set the number of threads for this MTE object
 void stop()
          Kill all threads in the pool and mark the pool for garbage collection.
 
Methods inherited from class org.egothor.distributor.STE
allow, iterate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MTE

public MTE()
Constructor for the MTE object.


MTE

public MTE(int threads)
Construct an MTE object with the specified number of threads.

Parameters:
threads - the number of threads
Method Detail

setThreads

public void setThreads(int threads)
Set the number of threads for this MTE object

Parameters:
threads - the new number of threads

getThreads

public int getThreads()
Return the number of threads in this MTE.

Returns:
the number of threads

stop

public void stop()
Kill all threads in the pool and mark the pool for garbage collection.

Specified by:
stop in interface Distributor<T>
Overrides:
stop in class STE<T>

forEach

public void forEach(Sequence<T> to,
                    Task<T> task)
Put the task to all acting (inner) structures.

Specified by:
forEach in interface Distributor<T>
Overrides:
forEach in class STE<T>
Parameters:
to - an Enumeration of structures
task - the task