javax.slee.facilities
Class TimerOptions

java.lang.Object
  |
  +--javax.slee.facilities.TimerOptions
All Implemented Interfaces:
java.io.Serializable

public class TimerOptions
extends java.lang.Object
implements java.io.Serializable

The TimerOptions class specifies the behavior of a timer when it is set.

Persistent Timers A persistent timer is reinstated when the SLEE restarts after a complete shutdown (due to catastophic failure or operator shutdown). A non-persistent timer is lost in the same circumstance.

Even though a timer can be persistent, its timer events cannot be fired when the SLEE is not running.

Timeout Under normal conditions and expected workload, a SLEE and its Timer Facility should be able to fire timer events on time. However, under overload conditions, or when the SLEE is not running, the Timer Facility may not be able to do so. The timeout value allows some flexibility in deciding when a scheduled timer becomes late. A timer is considered late if the Timer Facility cannot fire a scheduled timer event by its scheduled expiry time + timer timeout. For a periodic timer, the timeout must be less than the timer's period.

Preserving Missed Timer Events The default timer options cause the Timer Facility to only generate the last event in a sequence of late timer events for a timer that fires late. This guarantees at least one timer event (the last, for a periodic timer) will be generated for a timer. However an SBB can still choose to receive all or none of the late timer events if desired.

See Also:
Serialized Form

Constructor Summary
TimerOptions()
          Create a TimerOptions object that describes the default timer behavior.
TimerOptions(boolean persistent, long timeout, TimerPreserveMissed preserveMissed)
          Create a TimerOptions object for the specified timer behavior.
TimerOptions(TimerOptions options)
          Create a TimerOptions object that has the same behavioral properties as another TimerOptions.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compare this timer options object for equality with another.
 TimerPreserveMissed getPreserveMissed()
          Get the value of the preserve-missed option.
 long getTimeout()
          Get the timeout period.
 int hashCode()
          Get a hash code value for this timer options object.
 boolean isPersistent()
          Test if the persistent timer flag is set.
 void setPersistent(boolean persistent)
          Set the persistent timer flag.
 void setPreserveMissed(TimerPreserveMissed preserveMissed)
          Set the value of the preserve missed option.
 void setTimeout(long timeout)
          Set the timeout period.
 java.lang.String toString()
          Get the textual representation of the timer options object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimerOptions

public TimerOptions()
Create a TimerOptions object that describes the default timer behavior. The default timer behavior is:

TimerOptions

public TimerOptions(TimerOptions options)
Create a TimerOptions object that has the same behavioral properties as another TimerOptions.
Parameters:
options - the TimerOptions object to copy.

TimerOptions

public TimerOptions(boolean persistent,
                    long timeout,
                    TimerPreserveMissed preserveMissed)
             throws java.lang.NullPointerException,
                    java.lang.IllegalArgumentException
Create a TimerOptions object for the specified timer behavior.
Parameters:
persistent - boolean value indicating whether the timer should be persistent or not.
timeout - the timeout period for the timer (specified in milliseconds).
preserveMissed - the behavior of late timers.
Throws:
java.lang.NullPointerException - if preserveMissed is null.
java.lang.IllegalArgumentException - if timeout is less than zero.
Method Detail

isPersistent

public final boolean isPersistent()
Test if the persistent timer flag is set.
Returns:
true if the timer should be persistent, false otherwise.

setPersistent

public final void setPersistent(boolean persistent)
Set the persistent timer flag.
Parameters:
persistent - boolean value indicating whether the timer should be persistent or not.

getTimeout

public final long getTimeout()
Get the timeout period.
Returns:
the timeout period.

setTimeout

public final void setTimeout(long timeout)
                      throws java.lang.IllegalArgumentException
Set the timeout period.
Parameters:
timeout - the timeout period (specified in milliseconds).
Throws:
java.lang.IllegalArgumentException - if timeout less than zero.

getPreserveMissed

public final TimerPreserveMissed getPreserveMissed()
Get the value of the preserve-missed option.
Returns:
the value of the preserve-missed option.

setPreserveMissed

public final void setPreserveMissed(TimerPreserveMissed preserveMissed)
                             throws java.lang.NullPointerException
Set the value of the preserve missed option.
Parameters:
preserveMissed - the behavior of late timers.
Throws:
java.lang.NullPointerException - if preserveMissed is null.

equals

public boolean equals(java.lang.Object obj)
Compare this timer options object for equality with another.
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this with.
Returns:
true if obj is an instance of this class representing the same timer options as this, false otherwise.

hashCode

public int hashCode()
Get a hash code value for this timer options object.
Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value.

toString

public java.lang.String toString()
Get the textual representation of the timer options object.
Overrides:
toString in class java.lang.Object
Returns:
the textual representation of the timer options object.