com.funambol.util
Class ThreadPool

java.lang.Object
  extended by com.funambol.util.ThreadPool
All Implemented Interfaces:
java.lang.Runnable

public class ThreadPool
extends java.lang.Object
implements java.lang.Runnable

A default implementation of a ThreadPool built with a maximum number of live threads.


Field Summary
protected  ThreadPoolMonitor monitor
           
protected  Queue queue
           
protected  boolean stopped
           
 
Constructor Summary
ThreadPool(int numberOfThreads)
           
ThreadPool(ThreadPoolMonitor monitor, int numberOfThreads)
           
 
Method Summary
 int getRunnableCount()
          Returns number of runnable object in the queue.
 void run()
          The method run by the pool of background threads
 java.lang.Thread startThread()
          Start a new thread running
 void startThread(java.lang.Runnable task)
          Dispatch a new task in the pool to be invoked asynchronously later if possible
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queue

protected Queue queue

stopped

protected boolean stopped

monitor

protected final ThreadPoolMonitor monitor
Constructor Detail

ThreadPool

public ThreadPool(ThreadPoolMonitor monitor,
                  int numberOfThreads)

ThreadPool

public ThreadPool(int numberOfThreads)
Method Detail

startThread

public java.lang.Thread startThread()
Start a new thread running


stop

public void stop()

getRunnableCount

public int getRunnableCount()
Returns number of runnable object in the queue.


startThread

public void startThread(java.lang.Runnable task)
Dispatch a new task in the pool to be invoked asynchronously later if possible


run

public void run()
The method run by the pool of background threads

Specified by:
run in interface java.lang.Runnable


Copyright © 2006 Funambol.