aicas logoJamaica 6.1 release 1

javax.realtime
Class PeriodicTimer

java.lang.Object
  extended by javax.realtime.AsyncEvent
      extended by javax.realtime.Timer
          extended by javax.realtime.PeriodicTimer

public class PeriodicTimer
extends Timer

Jamaica Real-Time Specification for Java class PeriodicTimer.

This timer event fires periodically.


Constructor Summary
PeriodicTimer(HighResolutionTime start, RelativeTime interval, AsyncEventHandler handler)
          Constructor to create an instance with given time, interval and handler.
PeriodicTimer(HighResolutionTime start, RelativeTime interval, Clock clock, AsyncEventHandler handler)
          Constructor to create an instance with given time, interval, clock and handler.
 
Method Summary
 ReleaseParameters createReleaseParameters()
           createReleaseParameters creates the default release parameters for this event.
 AbsoluteTime getFireTime()
          getFireTime returns the time at which this timer is expected to fire or skip firing (because it is disabled) next.
 RelativeTime getInterval()
          getInterval returns the interval of this periodic timer.
 void setInterval(RelativeTime newinterval)
          setInterval changes the interval for this periodic timer.
 
Methods inherited from class javax.realtime.Timer
destroy, disable, enable, fire, getClock, getFireTime, isRunning, reschedule, start, start, stop
 
Methods inherited from class javax.realtime.AsyncEvent
addHandler, bindTo, handledBy, removeHandler, setHandler, unbindTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeriodicTimer

public PeriodicTimer(HighResolutionTime start,
                     RelativeTime interval,
                     AsyncEventHandler handler)
Constructor to create an instance with given time, interval and handler.

Parameters:
start - The time when this timer should fire first. May be null, in this case this is equal to new RelativeTime(0,0) and the firing will occur immediately after a call to start().
interval - The interval or null to get a behavior like OneShotTimer.
handler - The handler that will be released when this timer fires. May be null to have no handler until one will be added via addHandler.
Throws:
java.lang.IllegalArgumentException - if time or interval is a negative RelativeTime.

PeriodicTimer

public PeriodicTimer(HighResolutionTime start,
                     RelativeTime interval,
                     Clock clock,
                     AsyncEventHandler handler)
Constructor to create an instance with given time, interval, clock and handler.

Parameters:
start - The time when this timer should fire first. May be null, in this case this is equal to new RelativeTime(0,0) and the firing will occur immediately after a call to start().
interval - The interval or null to get a behavior like OneShotTimer.
clock - the clock this timer should be based upon. May be null to use the default System.getRealtimeClock().
handler - The handler that will be released when this timer fires. May be null to have no handler until one will be added via addHandler.
Throws:
java.lang.IllegalArgumentException - if time or interval is a negative RelativeTime.
Method Detail

createReleaseParameters

public ReleaseParameters createReleaseParameters()

createReleaseParameters creates the default release parameters for this event. This implementation creates PeriodicParemters using the interval specified for this without cost/deadline and without overrun or miss handler.

Overrides:
createReleaseParameters in class Timer
Returns:
An instance of ReleaseParameters appropriate for handlers for this event.
Throws:
java.lang.IllegalStateException - if this timer is destroyed.

getFireTime

public AbsoluteTime getFireTime()
getFireTime returns the time at which this timer is expected to fire or skip firing (because it is disabled) next.

Overrides:
getFireTime in class Timer
Returns:
a new instance of AbsoluteTime that holds the next firing time.
Throws:
java.lang.IllegalStateException - if this timer has been destroyed.

getInterval

public RelativeTime getInterval()
getInterval returns the interval of this periodic timer.

Returns:
the interval.
Throws:
java.lang.IllegalStateException - if this timer has been destroyed.

setInterval

public void setInterval(RelativeTime newinterval)
setInterval changes the interval for this periodic timer.

Parameters:
newinterval - the new interval.
Throws:
java.lang.IllegalArgumentException - if time or interval is a negative RelativeTime.

aicas logoJamaica 6.1 release 1

aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2012 aicas GmbH. All Rights Reserved.