de.myfoo.commonj.util
Class ThreadPool

java.lang.Object
  extended by de.myfoo.commonj.util.ThreadPool

public final class ThreadPool
extends java.lang.Object

Thread pool implemetation to execute Work and Timers.

Version:
1.0
Author:
Andreas Keldenich

Constructor Summary
ThreadPool(int minThreads, int maxThreads, int queueLength)
          Creates a new instance of ThreadPool.
 
Method Summary
 void execute(java.lang.Runnable command)
          Arrange for the given command to be executed by a thread in this pool.
 void shutdown()
          Shutdown the pool after processing the currently queue tasks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadPool

public ThreadPool(int minThreads,
                  int maxThreads,
                  int queueLength)
Creates a new instance of ThreadPool.

Parameters:
minThreads - mininum number of threads
maxThreads - maximum number of threads
queueLength - length of the execution queue
Method Detail

execute

public void execute(java.lang.Runnable command)
             throws java.lang.InterruptedException
Arrange for the given command to be executed by a thread in this pool. The method normally returns when the command has been handed off for (possibly later) execution.

Parameters:
command - command to execute
Throws:
java.lang.InterruptedException - if execution fails

shutdown

public void shutdown()
Shutdown the pool after processing the currently queue tasks.