org.objectweb.dream.control.activity.manager
Class ThreadPoolPerTaskSchedulerManagerImpl

java.lang.Object
  extended by org.objectweb.dream.AbstractComponent
      extended by org.objectweb.dream.control.activity.manager.AbstractSchedulerManager
          extended by org.objectweb.dream.control.activity.manager.ThreadPoolPerTaskSchedulerManagerImpl
All Implemented Interfaces:
EndOfThread, SchedulerManager, ThreadPoolManager, InterruptTask, ContextualBindingController, NeedAsyncStartController, PrepareStopLifeCycleController, Loggable, BindingController, LifeCycleController

public class ThreadPoolPerTaskSchedulerManagerImpl
extends AbstractSchedulerManager
implements ThreadPoolManager, EndOfThread

Scheduler manager that schedules each task with a MultiThreadForwarderSchedulerImpl and initially no thread.


Field Summary
 
Fields inherited from class org.objectweb.dream.control.activity.manager.AbstractSchedulerManager
ACTIVITY_CONTENT_CONTROLLER_ITF_NAME, contentControllerItf, threadManagerItf
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, fcNeedAsyncStart, fcState, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.control.activity.manager.ThreadPoolManager
ITF_NAME
 
Fields inherited from interface org.objectweb.dream.control.activity.manager.EndOfThread
ITF_NAME
 
Fields inherited from interface org.objectweb.dream.control.activity.manager.SchedulerManager
ITF_NAME
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
ThreadPoolPerTaskSchedulerManagerImpl()
           
 
Method Summary
 void addThread(Task task)
          Adds a thread to the given task.
 int getNbActiveThreads(Task task)
          Returns the number of currently active threads for the given task.
 void interruptTask(Task task)
          Interrupts the given task.
 Object scheduleTask(Task task, Map hints)
          Binds the given task to an appropriate scheduler.
 boolean threadEnded(Task thread)
          Notifies the activity manager that the thread, the given task interface belong, has ended its execution.
 void unscheduleTask(Task task)
          Unbinds the given task from its scheduler.
 
Methods inherited from class org.objectweb.dream.control.activity.manager.AbstractSchedulerManager
bindFc, listFc
 
Methods inherited from class org.objectweb.dream.AbstractComponent
beforeFirstStart, bindFc, getFcNeedAsyncStart, getFcState, initComponent, lookupFc, prepareStopFc, setLogger, startFc, stopFc, unbindFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadPoolPerTaskSchedulerManagerImpl

public ThreadPoolPerTaskSchedulerManagerImpl()
Method Detail

scheduleTask

public Object scheduleTask(Task task,
                           Map hints)
                    throws IllegalTaskException
Description copied from interface: SchedulerManager
Binds the given task to an appropriate scheduler.

Specified by:
scheduleTask in interface SchedulerManager
Parameters:
task - a task to schedule.
hints - registration hints.
Returns:
an interface that can be used to control the task (may be null if no control is available on the task).
Throws:
IllegalTaskException - if an error occurs.
See Also:
SchedulerManager.scheduleTask(Task, Map)

unscheduleTask

public void unscheduleTask(Task task)
                    throws IllegalTaskException
Description copied from interface: SchedulerManager
Unbinds the given task from its scheduler.

Specified by:
unscheduleTask in interface SchedulerManager
Parameters:
task - a task.
Throws:
IllegalTaskException - if the given task is unknown.
See Also:
SchedulerManager.unscheduleTask(Task)

interruptTask

public void interruptTask(Task task)
                   throws IllegalTaskException
Description copied from interface: InterruptTask
Interrupts the given task. When the task ends its execution the activity manager will be notified using the EndOfTaskinterface.

Specified by:
interruptTask in interface InterruptTask
Parameters:
task - the task to interrupt.
Throws:
IllegalTaskException - if the given task is unknown.
See Also:
InterruptTask.interruptTask(Task)

threadEnded

public boolean threadEnded(Task thread)
Description copied from interface: EndOfThread
Notifies the activity manager that the thread, the given task interface belong, has ended its execution. This method returns if the thread should restart or stop its execution.

Specified by:
threadEnded in interface EndOfThread
Parameters:
thread - the task interface of the stopped thread.
Returns:
true if the thread should restart its execution.
See Also:
EndOfThread.threadEnded(Task)

getNbActiveThreads

public int getNbActiveThreads(Task task)
                       throws IllegalTaskException
Description copied from interface: ThreadPoolManager
Returns the number of currently active threads for the given task.

Specified by:
getNbActiveThreads in interface ThreadPoolManager
Parameters:
task - a task;
Returns:
the number of currently active threads for the given task.
Throws:
IllegalTaskException - if the given task is unknown
See Also:
ThreadPoolManager.getNbActiveThreads(Task)

addThread

public void addThread(Task task)
               throws ThreadPoolOverflowException,
                      IllegalTaskException
Description copied from interface: ThreadPoolManager
Adds a thread to the given task.

Specified by:
addThread in interface ThreadPoolManager
Parameters:
task - a task
Throws:
ThreadPoolOverflowException - if the thread can't be allocated (pool full for instance).
IllegalTaskException - if the given task is unknown
See Also:
ThreadPoolManager.addThread(Task)


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