sjt.util
Class Gate

java.lang.Object
  |
  +--sjt.util.Gate

public class Gate
extends java.lang.Object

Gate gathers all running thread and synch them once a particular task is executed.In the wait method, threads simply wait until the last thread is gathered. In the join method threads wait until each exit their run method.

Since:
SJT 0.1

Constructor Summary
Gate(int size)
          Create a Gate with a thread size.
 
Method Summary
static void join(ThreadingGroup group)
          Perform an immediate interrupt and join on all threads in the ThreadingGroup.
static void wait(ThreadingGroup group)
          Perform a join on all threads in the ThreadingGroup.
 void waitSynch()
          Place a thread into the wait state, and notify once the last thread size calls method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Gate

public Gate(int size)
Create a Gate with a thread size.
Parameters:
size - number of threads to wait
Method Detail

waitSynch

public void waitSynch()
               throws java.lang.InterruptedException
Place a thread into the wait state, and notify once the last thread size calls method.
Throws:
java.lang.InterruptedException -  

wait

public static void wait(ThreadingGroup group)
Perform a join on all threads in the ThreadingGroup.
Parameters:
group - ThreadingGroup collection of running threads.

join

public static void join(ThreadingGroup group)
Perform an immediate interrupt and join on all threads in the ThreadingGroup.
Parameters:
group - ThreadingGroup collection of running threads.