org.objectweb.dream.control.activity.task.thread
Class AbstractThreadTaskImpl

java.lang.Object
  extended by org.objectweb.dream.control.activity.task.thread.AbstractThreadTaskImpl
All Implemented Interfaces:
Task, BindingController, LifeCycleController
Direct Known Subclasses:
ThreadTaskImpl

public abstract class AbstractThreadTaskImpl
extends Object
implements Task, BindingController, LifeCycleController

Abstract class representing a thread task.


Field Summary
protected  EndOfThread endOfThreadItf
           
protected  Logger logger
           
protected  Scheduler schedulerItf
          The scheduler to which the thread is bound.
 
Fields inherited from interface org.objectweb.dream.control.activity.task.Task
EXECUTE_AGAIN, ITF_NAME, STOP_EXECUTING
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
AbstractThreadTaskImpl()
           
 
Method Summary
 void bindFc(String clientItfName, Object serverItf)
           
 Object execute(Object hints)
          The method that is executed.
 String getFcState()
           
 void interrupted()
          Call back method used by scheduler to notify a task that has been interrupted.
protected abstract  boolean isExecuting()
          Called by execute(Object)method.
 String[] listFc()
           
 Object lookupFc(String clientItfName)
           
 void registered(Object controlItf)
          Call back method to notify that the task as been correctly registered in the task manager.
protected abstract  void setExecuting(boolean b)
          Called by execute(Object)method.
 void startFc()
           
 void stopFc()
           
 void unbindFc(String clientItfName)
           
 void unregistered()
          Call back method to notify that the task has been unregistered from the activity manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

schedulerItf

protected Scheduler schedulerItf
The scheduler to which the thread is bound.


endOfThreadItf

protected EndOfThread endOfThreadItf

logger

protected Logger logger
Constructor Detail

AbstractThreadTaskImpl

public AbstractThreadTaskImpl()
Method Detail

isExecuting

protected abstract boolean isExecuting()
Called by execute(Object)method.

Returns:
false if the execute(Object)method must return.

setExecuting

protected abstract void setExecuting(boolean b)
Called by execute(Object)method. Sets its execution state.

Parameters:
b - false if the execute(Object)method must return.

execute

public Object execute(Object hints)
               throws InterruptedException
Description copied from interface: Task
The method that is executed.

Specified by:
execute in interface Task
Parameters:
hints - execution paramters.
Returns:
an object representing the execution result.
Throws:
InterruptedException - if this task is interrupted.
See Also:
Task.execute(Object)

interrupted

public void interrupted()
Description copied from interface: Task
Call back method used by scheduler to notify a task that has been interrupted. Task implementation may override this method to free resources and ensure that the task execution will end.

Specified by:
interrupted in interface Task
See Also:
Task.interrupted()

registered

public void registered(Object controlItf)
Description copied from interface: Task
Call back method to notify that the task as been correctly registered in the task manager.

Specified by:
registered in interface Task
Parameters:
controlItf - An interface that can be used to control the execution of the task. The runtime type of this interface depends on the registration hints. Can be null.
See Also:
Task.registered(Object)

unregistered

public void unregistered()
Description copied from interface: Task
Call back method to notify that the task has been unregistered from the activity manager.

Specified by:
unregistered in interface Task
See Also:
Task.unregistered()

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)

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)

lookupFc

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

listFc

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

getFcState

public String getFcState()
Specified by:
getFcState in interface LifeCycleController
See Also:
LifeCycleController.getFcState()

stopFc

public void stopFc()
            throws IllegalLifeCycleException
Specified by:
stopFc in interface LifeCycleController
Throws:
IllegalLifeCycleException
See Also:
LifeCycleController.stopFc()

startFc

public void startFc()
             throws IllegalLifeCycleException
Specified by:
startFc in interface LifeCycleController
Throws:
IllegalLifeCycleException
See Also:
LifeCycleController.startFc()


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