org.objectweb.dream.control.activity.scheduler
Class PeriodicSchedulerImpl

java.lang.Object
  extended by org.objectweb.dream.control.activity.scheduler.PeriodicSchedulerImpl
All Implemented Interfaces:
InterruptTask, Scheduler, ContextualBindingController, BindingController

public class PeriodicSchedulerImpl
extends Object
implements Scheduler, InterruptTask, ContextualBindingController

Scheduler for periodic task. Executes each task at a given period. This scheduler must be executed by only one thread.


Field Summary
protected  EndOfTask endOfTaskItf
           
protected  org.objectweb.dream.control.activity.scheduler.PeriodicSchedulerImpl.PeriodicTask executingTask
           
protected  Thread executingThread
           
protected  boolean interrupted
           
protected  Object lock
           
protected  Logger logger
           
protected  Map<String,Object> tasksItf
           
protected  org.objectweb.dream.control.activity.scheduler.PeriodicSchedulerImpl.PeriodicTask tasksQueue
           
 
Fields inherited from interface org.objectweb.dream.control.activity.scheduler.Scheduler
ITF_NAME
 
Constructor Summary
PeriodicSchedulerImpl()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
 void bindFc(String clientItfName, Object serverItf, Object hints)
          Binds the client interface whose name is given to a server interface.
 void interruptTask(Task task)
          Interrupts the given task.
 String[] listFc()
           
 Object lookupFc(String clientItfName)
           
 Object schedule(int executionQuanta, Object hints)
          Scheduling method.
 void unbindFc(String clientItfName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tasksItf

protected Map<String,Object> tasksItf

endOfTaskItf

protected EndOfTask endOfTaskItf

logger

protected Logger logger

executingThread

protected Thread executingThread

executingTask

protected org.objectweb.dream.control.activity.scheduler.PeriodicSchedulerImpl.PeriodicTask executingTask

interrupted

protected boolean interrupted

tasksQueue

protected org.objectweb.dream.control.activity.scheduler.PeriodicSchedulerImpl.PeriodicTask tasksQueue

lock

protected Object lock
Constructor Detail

PeriodicSchedulerImpl

public PeriodicSchedulerImpl()
Method Detail

schedule

public Object schedule(int executionQuanta,
                       Object hints)
                throws InterruptedException
Description copied from interface: Scheduler
Scheduling method.

Specified by:
schedule in interface Scheduler
Parameters:
executionQuanta - the amount of execution time the scheduler can use. if negative, the scheduler can loop until until it has no task to execute.
hints - scheduling parameters.
Returns:
An object that represents the scheduling result.
Throws:
InterruptedException - if the scheduller was interrupted.
See Also:
Scheduler.schedule(int, Object)

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)

bindFc

public void bindFc(String clientItfName,
                   Object serverItf,
                   Object hints)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Description copied from interface: ContextualBindingController
Binds the client interface whose name is given to a server interface. More precisely, binds the client interface of the component to which this interface belongs, and whose name is equal to the given name, to the given server interface. The given server interface must be in the same address space as the client interface. Contextual information can be given using the hints parameter.

Specified by:
bindFc in interface ContextualBindingController
Parameters:
clientItfName - the name of a client interface of the component to which this interface belongs.
serverItf - a server interface.
hints - contextual information.
Throws:
NoSuchInterfaceException - if there is no such client interface.
IllegalBindingException - if the binding cannot be created.
IllegalLifeCycleException - if this component has a LifeCycleController interface, but it is not in an appropriate state to perform this operation.
See Also:
ContextualBindingController.bindFc(String, Object, Object)

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Specified by:
bindFc in interface BindingController
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.bindFc(String, Object)

lookupFc

public Object lookupFc(String clientItfName)
                throws NoSuchInterfaceException
Specified by:
lookupFc in interface BindingController
Throws:
NoSuchInterfaceException
See Also:
BindingController.lookupFc(String)

unbindFc

public void unbindFc(String clientItfName)
              throws NoSuchInterfaceException,
                     IllegalBindingException,
                     IllegalLifeCycleException
Specified by:
unbindFc in interface BindingController
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.unbindFc(String)

listFc

public String[] listFc()
Specified by:
listFc in interface BindingController
See Also:
BindingController.listFc()


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