org.iids.aos.systemservices.module
Class AbstractRunnableModule

java.lang.Object
  extended by org.iids.aos.systemservices.module.AbstractModule
      extended by org.iids.aos.systemservices.module.AbstractRunnableModule
All Implemented Interfaces:
java.lang.Runnable, Module
Direct Known Subclasses:
AgentRegistrationModule, AgentScapeDCLeaseManagement, AgentScapeDCTemplateManagement, AgentScapeHMLeaseManagement, LocationConfigurationModule, RegistrationModule, WSGatewayMainModule

public abstract class AbstractRunnableModule
extends AbstractModule
implements java.lang.Runnable

An AbstractRunnableModule has its own running thread. This thread will call the abstract pulse() method periodically. The interval between two calls is determined by the sleepTime given to the constructor. Note: it is not guaranteed that the pulse() will be called on time. Scheduling algorithms determine the exact time when the pulse() will be called. Warning: only if the call to pulse() returns can this module call it periodically. Hint: providing a sleepTime of 0 will cause the pulse() method to be called _only once_. This is usefull if you want to control the thread yourself.

Author:
hidde@cs.vu.nl, rjtimmer@cs.vu.nl

Constructor Summary
AbstractRunnableModule(java.lang.String _moduleName, Communicator _communicator, long _sleepTime)
           
 
Method Summary
 boolean isStarted()
           
abstract  void pulse()
           
 void run()
           
abstract  void shutdown()
          Each abstract RUNNABLE module implementation must implement the shutdown method, which is called whenever the module is stopped (by stop()) from the superclass.
 void start()
           
 void stop()
           
 
Methods inherited from class org.iids.aos.systemservices.module.AbstractModule
getCommunicator, getModuleName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractRunnableModule

public AbstractRunnableModule(java.lang.String _moduleName,
                              Communicator _communicator,
                              long _sleepTime)
Method Detail

start

public void start()
Specified by:
start in interface Module

stop

public void stop()
Specified by:
stop in interface Module

isStarted

public boolean isStarted()
Specified by:
isStarted in interface Module

run

public void run()
Specified by:
run in interface java.lang.Runnable

shutdown

public abstract void shutdown()
Each abstract RUNNABLE module implementation must implement the shutdown method, which is called whenever the module is stopped (by stop()) from the superclass.


pulse

public abstract void pulse()


Copyright © 2003, 2004 IIDS Group. All Rights Reserved.