p2ps.imp.endpoint
Class ThreadPool

java.lang.Object
  extended byp2ps.imp.endpoint.ThreadPool

public class ThreadPool
extends java.lang.Object

A utility thread pool.

Version:
$Revision: 295 $
Author:
Ian Wang

Field Summary
static int DEFAULT_IDLE_TIME_MILLIS
           
static int DEFAULT_MAXIMUM_THREADS
           
static int DEFAULT_MINIMUM_THREADS
           
 
Constructor Summary
ThreadPool(java.lang.String name)
          Constructs a thread pool with default min and max threads and idle time
ThreadPool(java.lang.String name, int min, int max, int idle)
          Constructs a thread pool with specified min and max threads and idle time
 
Method Summary
 void addTask(java.lang.Runnable task)
           
 void dispose()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MINIMUM_THREADS

public static int DEFAULT_MINIMUM_THREADS

DEFAULT_MAXIMUM_THREADS

public static int DEFAULT_MAXIMUM_THREADS

DEFAULT_IDLE_TIME_MILLIS

public static int DEFAULT_IDLE_TIME_MILLIS
Constructor Detail

ThreadPool

public ThreadPool(java.lang.String name)
Constructs a thread pool with default min and max threads and idle time


ThreadPool

public ThreadPool(java.lang.String name,
                  int min,
                  int max,
                  int idle)
Constructs a thread pool with specified min and max threads and idle time

Parameters:
name - the name of the thread pool
min - the minimum number of threads that is maintained by the pool
max - the maximum number of threads that is maintained by the pool
idle - the time a thread is idle before it is disposed
Method Detail

addTask

public void addTask(java.lang.Runnable task)

dispose

public void dispose()