net.jetrix.services
Class ScheduledService

java.lang.Object
  extended by net.jetrix.services.AbstractService
      extended by net.jetrix.services.ScheduledService
All Implemented Interfaces:
Service
Direct Known Subclasses:
GhostbusterService, PublishingService

public abstract class ScheduledService
extends AbstractService

A service running a task at a fixed rate. Services based on ScheduledService expect a delay parameter for the delay in milliseconds before the task is first executed, and a period parameter for the time in milliseconds between successive executions of the task.

Since:
0.2
Version:
$Revision: 558 $, $Date: 2005-01-09 19:48:58 +0100 (dim., 09 janv. 2005) $
Author:
Emmanuel Bourg

Field Summary
 
Fields inherited from class net.jetrix.services.AbstractService
autoStart, log
 
Constructor Summary
ScheduledService()
           
 
Method Summary
 long getDelay()
          Get the delay in milliseconds before the task is first executed.
 long getPeriod()
          Get the time in milliseconds between successive executions of the task.
protected  void init()
          Initialization performed before the timer is started.
 boolean isRunning()
          Check is the service is running.
protected abstract  void run()
          Execute the task
 void setDelay(long delay)
          Set the delay in milliseconds before the task is first executed.
 void setPeriod(long period)
          Set the time in milliseconds between successive executions of the task.
 void start()
          Start the service.
 void stop()
          Stop the service.
 
Methods inherited from class net.jetrix.services.AbstractService
isAutoStart, setAutoStart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.jetrix.Service
getName
 

Constructor Detail

ScheduledService

public ScheduledService()
Method Detail

init

protected void init()
Initialization performed before the timer is started.


start

public void start()
Description copied from interface: Service
Start the service.


stop

public void stop()
Description copied from interface: Service
Stop the service.


isRunning

public boolean isRunning()
Check is the service is running.


run

protected abstract void run()
Execute the task


getPeriod

public long getPeriod()
Get the time in milliseconds between successive executions of the task.


setPeriod

public void setPeriod(long period)
Set the time in milliseconds between successive executions of the task.


getDelay

public long getDelay()
Get the delay in milliseconds before the task is first executed.


setDelay

public void setDelay(long delay)
Set the delay in milliseconds before the task is first executed.



Copyright © 2001-2008 Emmanuel Bourg. All Rights Reserved.