jsr.daemon.pausable
Class PausableDaemon

java.lang.Object
  |
  +--jsr.daemon.GenericDaemon
        |
        +--jsr.daemon.pausable.PausableDaemon
All Implemented Interfaces:
Daemon, DaemonConfig, ExtendedLogging, Logging, Pausable

public abstract class PausableDaemon
extends GenericDaemon
implements Pausable

abstract pausable daemon base class to be subclassed by pausable daemons All singleton accesses are synchronized via this daemon instance if applicable.


Constructor Summary
PausableDaemon()
          default constructor for this daemon
 
Method Summary
protected  void down(java.lang.Throwable throwable)
          method for indicating the activity state of this daemon used by this daemon for managing its own activity state after calling down initialization is required for getting this daemon active again
protected  void finalize()
          finalizer method for this pausable daemon
protected  DaemonControl getDaemonControl()
          access to the service provider pausable control interface of this pausable daemon method is called by the container for controlling the life state of this daemon
protected  DaemonEventHandler getEventHandler()
          method for accessing the event handler of this daemon
 boolean isActive()
          life state indication of this daemon state is managed by the container and/or by this daemon
 boolean isPaused()
          life state indication of this daemon state is managed by the container and/or by this daemon
 void pause(java.lang.Throwable throwable)
          method for indicating the pause state of this daemon used by this daemon for managing its own pause state after calling pause a restart is required for getting this daemon unpaused again
protected  void setPaused(boolean paused, java.lang.Throwable throwable)
          method for managing the pause state of this daemon
abstract  void start()
          start method for this daemon method is launched via the control interface and has to be subclassed
abstract  void stop()
          pause method for this daemon method is launched via the control interface and has to be subclassed
 
Methods inherited from class jsr.daemon.GenericDaemon
addListener, destroy, getAttribute, getAttributeNames, getDaemonConfig, getDaemonContext, getDaemonInfo, getDaemonName, init, log, log, removeListener, setActive
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jsr.daemon.Daemon
destroy, getDaemonConfig, getDaemonInfo, init
 

Constructor Detail

PausableDaemon

public PausableDaemon()
default constructor for this daemon
Method Detail

start

public abstract void start()
                    throws DaemonException
start method for this daemon method is launched via the control interface and has to be subclassed
Specified by:
start in interface Pausable
Throws:
DaemonException - thrown by an implementing daemon if starting or restarting fails

stop

public abstract void stop()
pause method for this daemon method is launched via the control interface and has to be subclassed
Specified by:
stop in interface Pausable

getDaemonControl

protected DaemonControl getDaemonControl()
access to the service provider pausable control interface of this pausable daemon method is called by the container for controlling the life state of this daemon
Overrides:
getDaemonControl in class GenericDaemon
Returns:
service provider control interface of this pausable daemon

getEventHandler

protected DaemonEventHandler getEventHandler()
method for accessing the event handler of this daemon
Overrides:
getEventHandler in class GenericDaemon
Returns:
event handler of this pausable daemon

down

protected void down(java.lang.Throwable throwable)
method for indicating the activity state of this daemon used by this daemon for managing its own activity state after calling down initialization is required for getting this daemon active again
Overrides:
down in class GenericDaemon
Parameters:
throwable - a throwable for informing listeners about an exception cause

setPaused

protected final void setPaused(boolean paused,
                               java.lang.Throwable throwable)
method for managing the pause state of this daemon
Parameters:
paused - flag indicating the current pause state
throwable - a throwable for indicating a possible exception

pause

public void pause(java.lang.Throwable throwable)
method for indicating the pause state of this daemon used by this daemon for managing its own pause state after calling pause a restart is required for getting this daemon unpaused again
Parameters:
throwable - a throwable for indicating a possible exception

isPaused

public boolean isPaused()
life state indication of this daemon state is managed by the container and/or by this daemon
Specified by:
isPaused in interface Pausable
Returns:
true if and only if the implementing daemon is paused

isActive

public boolean isActive()
life state indication of this daemon state is managed by the container and/or by this daemon
Specified by:
isActive in interface Daemon
Overrides:
isActive in class GenericDaemon
Returns:
true if and only if the implementing daemon is active

finalize

protected void finalize()
                 throws java.lang.Throwable
finalizer method for this pausable daemon
Overrides:
finalize in class GenericDaemon