com.johnmunsch.threadpool
Class ThreadPoolImpl

java.lang.Object
  |
  +--com.johnmunsch.threadpool.ThreadPoolImpl
All Implemented Interfaces:
ThreadPool

public class ThreadPoolImpl
extends java.lang.Object
implements ThreadPool


Constructor Summary
ThreadPoolImpl(int minThreads, int maxThreads, int maxIdleTime)
           
 
Method Summary
 void addJob(java.lang.Runnable job)
          The fundamental function of the thread pool.
 Stats getStats()
          Returns a stats object that tells the state of the thread pool at the time the function was called.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadPoolImpl

public ThreadPoolImpl(int minThreads,
                      int maxThreads,
                      int maxIdleTime)
               throws java.lang.IllegalArgumentException
Method Detail

addJob

public void addJob(java.lang.Runnable job)
The fundamental function of the thread pool. Note that it will never block or keep you from inserting yet another job into the queue. So, if you have a large (100,000 or more?) list of jobs to queue up, all will go into the list. For large job objects that could be a bad thing and you will need to find some mechanism to reduce the number of jobs you attempt to add at one time.

Specified by:
addJob in interface ThreadPool

getStats

public Stats getStats()
Returns a stats object that tells the state of the thread pool at the time the function was called.

Specified by:
getStats in interface ThreadPool