org.jwarp.service.threadpool
Interface IThreadPool

All Known Implementing Classes:
ThreadPool

public interface IThreadPool

The ThreadPool manages a pool of threads.
In the thread pool, as its name suggests, some threads are waiting for work to appear in the pool. As soon as there is work one of the waiting threads will take it and work on it.
The pool has an initial amount of threads which are created when the pool is created. It has also a maximum limit to which he can extend the number of threads. When work is added and no thread is currently waiting, the pool creates a new thread unless the maximum count of threads is already reached.
Currently the pool does not destroy any thread he once created.

Author:
Anatole Tresch

Method Summary
 void cancel(java.lang.Runnable work)
          Add work which will be eventually done by one of the threads in this pool.
 void execute(java.lang.Runnable work)
          Add work which will be eventually done by one of the threads in this pool.
 int getCurrentPoolSize()
          Gets the number of threads in this pool.
 void resumePool()
          Stop a pool.
 void startPool()
          Stop a pool.
 void stopPool()
          Stop a pool.
 void suspendPool()
          Stop a pool.
 

Method Detail

execute

public void execute(java.lang.Runnable work)
             throws ThreadPoolStoppedException
Add work which will be eventually done by one of the threads in this pool. The work is executed in a FIFO manner.
Parameters:
work - the work to do

cancel

public void cancel(java.lang.Runnable work)
Add work which will be eventually done by one of the threads in this pool. The work is executed in a FIFO manner.
Parameters:
work - the work to do

getCurrentPoolSize

public int getCurrentPoolSize()
Gets the number of threads in this pool.
Returns:
the number of threads

stopPool

public void stopPool()
Stop a pool.

startPool

public void startPool()
Stop a pool.

suspendPool

public void suspendPool()
Stop a pool.

resumePool

public void resumePool()
Stop a pool.

©   O R C A   S y s t e m s