example
Class Pool

java.lang.Object
  |
  +--example.Pool

public class Pool
extends java.lang.Object

Implements Thread Pooling. Thread Pool simply keeps a bunch of suspended threads around to do some work.


Nested Class Summary
(package private)  class Pool.WorkerThread
          Handler class for perform work requested by the Pool.
 
Constructor Summary
Pool(int max, java.lang.Class workerClass)
          Creates a new Pool instance
 
Method Summary
 void performWork(java.lang.Object data)
          Request the Pool to perform some work.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pool

public Pool(int max,
            java.lang.Class workerClass)
     throws java.lang.Exception
Creates a new Pool instance

Parameters:
max - Max number of handler threads
workerClass - Name of Worker implementation
Throws:
java.lang.Exception
Method Detail

performWork

public void performWork(java.lang.Object data)
                 throws java.lang.InstantiationException
Request the Pool to perform some work.

Parameters:
data - Data to give to the Worker
Returns:
void
Throws:
java.lang.InstantiationException - Thrown if additional worker can't be created