org.objectweb.dream.control.activity.task.thread
Interface ThreadPoolController

All Known Implementing Classes:
BasicThreadPoolTask

public interface ThreadPoolController

Controller interface for thread pool. It allows to increase or decrease the number of thread in the pool.


Method Summary
 void addThreads(int i)
          Adds threads in the pool.
 int getNbActiveThread()
          Returns the number of currently active threads.
 void removeThreads(int i)
          Removes threads from the pool.
 

Method Detail

getNbActiveThread

public int getNbActiveThread()
Returns the number of currently active threads.

Returns:
the number of currently active threads.

addThreads

public void addThreads(int i)
                throws ThreadPoolOverflowException,
                       IllegalLifeCycleException
Adds threads in the pool. If the thread pool is stopping (see TaskLifeCycleController) the added threads are immediatly interrupted.

Parameters:
i - the number of thread to add.
Throws:
ThreadPoolOverflowException - if getNbActiveThread() + i > getCapacity()
IllegalLifeCycleException - if the component this interface belong has a lifecycle controller and is in the LifeCycleController.STOPPED state.

removeThreads

public void removeThreads(int i)
                   throws IllegalLifeCycleException
Removes threads from the pool. The threads are removed in a FIFO order. This method is not synchronized with the end of the removed threads. This means that the method may return before the end of the removed threads.

Parameters:
i - the number of thread to remove.
Throws:
IllegalLifeCycleException - if the component this interface belong has a lifecycle controller and is in the LifeCycleController.STOPPED state.


Copyright © 2003, 2004 - INRIA Rhone-Alpes - All Rights Reserved.