|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.dream.AbstractComponent
org.objectweb.dream.control.activity.task.thread.AbstractThreadTask
org.objectweb.dream.control.activity.task.thread.BasicThreadPoolTask
Thread Pool implementation. In a thread pool, many threads call concurrently
the scheduler. The number of threads can be controlled by the
ThreadPoolController
control interface.
Field Summary |
Fields inherited from class org.objectweb.dream.control.activity.task.thread.AbstractThreadTask |
scheduler |
Fields inherited from class org.objectweb.dream.AbstractComponent |
bindingLogger, componentDesc, fcState, lifeCycleLogger, logger, weaveableC |
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController |
STARTED, STOPPED |
Fields inherited from interface org.objectweb.dream.control.activity.task.thread.ThreadPoolAttributeController |
DEFAULT_WAIT_TIMEOUT |
Fields inherited from interface org.objectweb.dream.control.activity.task.Task |
ITF_NAME |
Constructor Summary | |
BasicThreadPoolTask()
|
Method Summary | |
void |
addThreads(int i)
Adds threads in the pool. |
void |
asyncStop(TaskStoppedListener listener)
Stops asynchronously the task, this interface belong. |
int |
getCapacity()
Returns the capacity of the pool. |
int |
getNbActiveThread()
Returns the number of currently active threads. |
long |
getWaitTimeout()
Returns the timeout while "dying" thread can be "reactivated". |
protected void |
interruptPool()
|
protected boolean |
isExecuting()
Called by AbstractThreadTask.execute(Object) method. |
void |
removeThreads(int i)
Removes threads from the pool. |
void |
setCapacity(int i)
Sets the capacity of the pool. |
protected void |
setExecuting(boolean b)
Called by AbstractThreadTask.execute(Object) method. |
void |
setWaitTimeout(long millis)
Sets the timeout while a "dying" thread can be "reactivated" and reused, rather than create a new thread. |
void |
startFc()
|
void |
stopFc()
|
Methods inherited from class org.objectweb.dream.control.activity.task.thread.AbstractThreadTask |
bindFc, execute, listFc, unbindFc |
Methods inherited from class org.objectweb.dream.AbstractComponent |
getFcState, initComponent, lookupFc, setLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.objectweb.fractal.api.control.LifeCycleController |
getFcState |
Constructor Detail |
public BasicThreadPoolTask()
Method Detail |
protected boolean isExecuting()
AbstractThreadTask
AbstractThreadTask.execute(Object)
method.
isExecuting
in class AbstractThreadTask
false
if the AbstractThreadTask.execute(Object)
method must
return.AbstractThreadTask.isExecuting()
protected void setExecuting(boolean b)
AbstractThreadTask
AbstractThreadTask.execute(Object)
method. Sets its execution state.
setExecuting
in class AbstractThreadTask
b
- false
if the AbstractThreadTask.execute(Object)
method must
return.AbstractThreadTask.setExecuting(boolean)
public int getNbActiveThread()
ThreadPoolController
getNbActiveThread
in interface ThreadPoolController
ThreadPoolController.getNbActiveThread()
public void addThreads(int i) throws ThreadPoolOverflowException, IllegalLifeCycleException
ThreadPoolController
TaskLifeCycleController
)
the added threads are immediatly interrupted.
addThreads
in interface ThreadPoolController
i
- the number of thread to add.
ThreadPoolOverflowException
- if
getNbActiveThread() + i > getCapacity()
IllegalLifeCycleException
- if the component this interface belong
has a lifecycle controller and is in the
LifeCycleController.STOPPED
state.ThreadPoolController.addThreads(int)
public void removeThreads(int i) throws IllegalLifeCycleException
ThreadPoolController
removeThreads
in interface ThreadPoolController
i
- the number of thread to remove.
IllegalLifeCycleException
- if the component this interface belong
has a lifecycle controller and is in the
LifeCycleController.STOPPED
state.ThreadPoolController.removeThreads(int)
public void setCapacity(int i)
ThreadPoolAttributeController
setCapacity
in interface ThreadPoolAttributeController
i
- the capacity of the pool.ThreadPoolAttributeController.setCapacity(int)
public int getCapacity()
ThreadPoolAttributeController
getCapacity
in interface ThreadPoolAttributeController
ThreadPoolAttributeController.getCapacity()
public long getWaitTimeout()
ThreadPoolAttributeController
getWaitTimeout
in interface ThreadPoolAttributeController
ThreadPoolAttributeController.getWaitTimeout()
public void setWaitTimeout(long millis)
ThreadPoolAttributeController
setWaitTimeout
in interface ThreadPoolAttributeController
millis
- timeout in millisecond.ThreadPoolAttributeController.setWaitTimeout(long)
public void startFc() throws IllegalLifeCycleException
startFc
in interface LifeCycleController
startFc
in class AbstractComponent
IllegalLifeCycleException
LifeCycleController.startFc()
public void stopFc() throws IllegalLifeCycleException
stopFc
in interface LifeCycleController
stopFc
in class AbstractComponent
IllegalLifeCycleException
LifeCycleController.stopFc()
public void asyncStop(TaskStoppedListener listener)
TaskLifeCycleController
LifeCycleController.STOPPED
state,
the listener is immediatly notified.
asyncStop
in interface TaskLifeCycleController
listener
- listener nitified when the task has stopped.TaskLifeCycleController.asyncStop(TaskStoppedListener)
protected void interruptPool()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |