anon.util
Class ThreadPool

java.lang.Object
  extended by anon.util.ThreadPool

public final class ThreadPool
extends java.lang.Object


Nested Class Summary
private  class ThreadPool.ThreadPoolRequest
           
private  class ThreadPool.ThreadPoolThread
           
 
Field Summary
private  CondVar cvAvailable
           
private  CondVar cvEmpty
           
private  BusyFlag cvFlag
           
private  int nMaxThreads
           
private  int nObjects
           
private  java.util.Vector objects
           
private  ThreadPool.ThreadPoolThread[] poolThreads
           
private  boolean terminated
           
 
Constructor Summary
ThreadPool(java.lang.String name, int n)
           
ThreadPool(java.lang.String name, int n, int priority)
           
 
Method Summary
private  void add(java.lang.Runnable target, java.lang.Object lock)
           
 void addRequest(java.lang.Runnable target)
           
 void addRequestAndWait(java.lang.Runnable target)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objects

private java.util.Vector objects

nObjects

private int nObjects

nMaxThreads

private int nMaxThreads

cvAvailable

private CondVar cvAvailable

cvEmpty

private CondVar cvEmpty

cvFlag

private BusyFlag cvFlag

poolThreads

private ThreadPool.ThreadPoolThread[] poolThreads

terminated

private boolean terminated
Constructor Detail

ThreadPool

public ThreadPool(java.lang.String name,
                  int n)

ThreadPool

public ThreadPool(java.lang.String name,
                  int n,
                  int priority)
Method Detail

add

private void add(java.lang.Runnable target,
                 java.lang.Object lock)

addRequest

public void addRequest(java.lang.Runnable target)

addRequestAndWait

public void addRequestAndWait(java.lang.Runnable target)
                       throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException