com.sun.jaw.impl.agent.services.alarm
Class AlarmClock

java.lang.Object
  |
  +--com.sun.jaw.impl.agent.services.alarm.AlarmClock

public class AlarmClock
extends java.lang.Object
implements java.lang.Runnable, java.io.Serializable, ActivatableIf

This class provides a simple implementation of an alarm-clock service.

The aim of this service is to set up an alarm which wakes up all the listeners registered to receive events of type AlarmClock.

See Also:
Serialized Form

Constructor Summary
AlarmClock()
          Default constructor.
 
Method Summary
 void addAlarmClockListener(AlarmClockListener listener)
          Allows to register a listener for receiving alarm-clock events.
 void deleteCmf()
          Delete the alarm-clock.
 java.lang.Integer getTimeout()
          Deprecated.  
 java.lang.Long getTimeoutAsLong()
          Returns the timeout value (in milliseconds).
 void initCmf(Framework cmf, ObjectName name, boolean db, ModificationList list)
          Initialize the alarm-clock.
 boolean isActive()
          Test if the alarm-clock is active.
 void performStart()
          Starts the alarm-clock count.
 void performStop()
          Stops the alarm-clock count.
 void removeAlarmClockListener(AlarmClockListener listener)
          Enables a listener for alarm-clock events to be removed.
 void run()
          This method is called by the thread created when the alarm-clock is started.
 void setTimeout(java.lang.Integer time)
          Deprecated.  
 void setTimeoutAsLong(java.lang.Long time)
          Sets the timeout value (in milliseconds).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlarmClock

public AlarmClock()
Default constructor.
Method Detail

initCmf

public void initCmf(Framework cmf,
                    ObjectName name,
                    boolean db,
                    ModificationList list)
             throws InstanceAlreadyExistException
Initialize the alarm-clock. The method will declare the object to the Core Management Framework.
For internal use only.
Parameters:
agent - The core management framework to register the service with.
name - Object name.
db - Indicates if persistent storage is required.
list - The modification list to use for setting up parameters.
Throws:
InstanceAlreadyExistException - The m-bean is already registered in the repository.

deleteCmf

public void deleteCmf()
Delete the alarm-clock.

performStart

public void performStart()
Starts the alarm-clock count.
Specified by:
performStart in interface ActivatableIf

performStop

public void performStop()
Stops the alarm-clock count.
Specified by:
performStop in interface ActivatableIf

isActive

public boolean isActive()
Test if the alarm-clock is active.
Specified by:
isActive in interface ActivatableIf

run

public void run()
This method is called by the thread created when the alarm-clock is started.
Specified by:
run in interface java.lang.Runnable

addAlarmClockListener

public void addAlarmClockListener(AlarmClockListener listener)
Allows to register a listener for receiving alarm-clock events.

removeAlarmClockListener

public void removeAlarmClockListener(AlarmClockListener listener)
Enables a listener for alarm-clock events to be removed.

getTimeoutAsLong

public java.lang.Long getTimeoutAsLong()
Returns the timeout value (in milliseconds).
Since:
JDMK 3.0 patch

getTimeout

public java.lang.Integer getTimeout()
Deprecated.  

setTimeoutAsLong

public void setTimeoutAsLong(java.lang.Long time)
Sets the timeout value (in milliseconds).
Since:
JDMK 3.0 patch

setTimeout

public void setTimeout(java.lang.Integer time)
Deprecated.