sjt.mgmt
Interface ThreadingGroup

All Known Implementing Classes:
ThreadArray

public interface ThreadingGroup

An interface for a threading group collection. Used to accomodate switching from various types of collection classes. May simply wrap a java.util.ThreadGroup, or may simply use an array of threads.

Since:
SJT 0.1

Method Summary
 void addThread(java.lang.Thread thread)
          Add thread to the wrapped collection.
 void destroy()
          Destroy can be called by the user code in order to prompt joining and cleanup of all working threads.
 boolean isEmpty()
          Check whether work has one or more work items in collection.
 java.lang.Thread removeThread()
          Remove one thread from the wrapped collection.
 int size()
          Check how many items in work collection.
 java.lang.Thread useThread()
          Similiar to removeThread but the thread reference is maintained in Group.
 

Method Detail

addThread

public void addThread(java.lang.Thread thread)
Add thread to the wrapped collection. Threads are added by ThreadManager only.
Parameters:
thread - One working thread.

removeThread

public java.lang.Thread removeThread()
Remove one thread from the wrapped collection. The collection itself will decide which thread is returned. FIFO, LIFO, and any other necessary ordering. Thread should be added back into the collection by the ThreadManager.
Returns:
thread A working thread.

useThread

public java.lang.Thread useThread()
Similiar to removeThread but the thread reference is maintained in Group.
Returns:
thread A working thread.

size

public int size()
Check how many items in work collection.
Returns:
size of work collection.

isEmpty

public boolean isEmpty()
Check whether work has one or more work items in collection.
Returns:
true or false if collection empty.

destroy

public void destroy()
Destroy can be called by the user code in order to prompt joining and cleanup of all working threads. Destroy is also called by the finalize method, during garbage collection, if the user code does not call it explicitly.