aicas logoJamaica 6.1 release 1

javax.realtime
Class PeriodicParameters

java.lang.Object
  extended by javax.realtime.ReleaseParameters
      extended by javax.realtime.PeriodicParameters
All Implemented Interfaces:
java.lang.Cloneable

public class PeriodicParameters
extends ReleaseParameters
implements java.lang.Cloneable

Jamaica Real-Time Specification for Java class PeriodicParameters.

This class characterizes the release of schedulable objects that are released regularly at constant intervals. Used as release parameters for a RealtimeThread, this enables the thread to wait for the next release by a call to waitForNextPeriod or waitForNextPeriodInterruptible(). Used as release parameters for an AsyncEventHandler, this indicates that this handler is released by events that occur periodically such as a PeriodicTimer. Note that for an AsyncEventHandler, the periodic release is not enforced automatically by the scheduler, the release parameters are only used for feasibility analysis in this case.

Note that any changes to RelativeTime or HighResolutionTime arguments of this object do not propagate to the schedulable object until the corresponding setter method of AperiodicParameters is called to notify this object about the change.

NOTE: the methods in this class are not synchronized. They cannot be used by several threads simultaneously without proper explicit synchronization.


Constructor Summary
PeriodicParameters(HighResolutionTime start, RelativeTime period)
          Create a PeriodicParameters object.
PeriodicParameters(HighResolutionTime start, RelativeTime period, RelativeTime cost, RelativeTime deadline, AsyncEventHandler overrunHandler, AsyncEventHandler missHandler)
          Constructor to create an instance of PeriodicParameters with the given initial settings.
PeriodicParameters(RelativeTime period)
          Create a PeriodicParameters object.
 
Method Summary
 java.lang.Object clone()
          clone creates a clone of this object with the same parameters but without association to any schedulable object.
 RelativeTime getPeriod()
          getPeriod returns the current period.
 HighResolutionTime getStart()
          getStart returns the start time.
 boolean setIfFeasible(RelativeTime period, RelativeTime cost, RelativeTime deadline)
          setIfFeasible performs a feasibility analysis using the new period, cost, and deadline parameters.
 void setPeriod(RelativeTime period)
          setPeriod sets the period.
 void setStart(HighResolutionTime start)
          setStart set the start time.
 
Methods inherited from class javax.realtime.ReleaseParameters
getCost, getCostOverrunHandler, getDeadline, getDeadlineMissHandler, setCost, setCostOverrunHandler, setDeadline, setDeadlineMissHandler, setIfFeasible, setIfFeasible
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeriodicParameters

public PeriodicParameters(HighResolutionTime start,
                          RelativeTime period)
Create a PeriodicParameters object. This constructor has the same effect as invoking PeriodicParameters(start, period, null, null, null, null).

Parameters:
start - The time of the first release. If start is an instance of RelativeTime, its value will be used as the release time of the associated thread relative to the time the start() method of the thread was called. If an instance of class AbsoluteTime is passed, the associated thread will be released either at the time start() is called or at the time corresponding to the start parameter, whichever comes later. If null, the default value will be new RelativeTime(0,0).
period - The time between two periodic releases, in other words, the time interval between the return of two successive calls to interval between the return of two successive calls to waitForNextPeriod() or waitForNextPeriodInterruptible(). This argument must not be null or a time <=0.
Throws:
java.lang.IllegalArgumentException - if start is a negative RelativeTime, if the period is null or negative or zero, if cost is negative or deadline is negative or zero.

PeriodicParameters

public PeriodicParameters(RelativeTime period)
Create a PeriodicParameters object. This constructor has the same effect as invoking PeriodicParameters(null, period, null, null, null, null).

Parameters:
period - The time between two periodic releases, in other words, the time interval between the return of two successive calls to waitForNextPeriod() or waitForNextPeriodInterruptible(). This argument must not be null or a time <=0.
Throws:
java.lang.IllegalArgumentException - if start is a negative RelativeTime, if the period is null or negative or zero, if cost is negative or deadline is negative or zero.

PeriodicParameters

public PeriodicParameters(HighResolutionTime start,
                          RelativeTime period,
                          RelativeTime cost,
                          RelativeTime deadline,
                          AsyncEventHandler overrunHandler,
                          AsyncEventHandler missHandler)
Constructor to create an instance of PeriodicParameters with the given initial settings.

Parameters:
start - The time of the first release. If start is an instance of RelativeTime, its value will be used as the release time of the associated thread relative to the time the start() method of the thread was called. If an instance of class AbsoluteTime is passed, the associated thread will be released either at the time start() is called or at the time corresponding to the start parameter, whichever comes later. If null, the default value will be new RelativeTime(0,0).
period - The time between two periodic releases, in other words, the time interval between the return of two successive calls to waitForNextPeriod() or waitForNextPeriodInterruptible(). This argument must not be null or a time <= 0.
cost - The CPU time required for each release. If cost monitoring is performed, this gives the maximum amount of CPU time that will be allowed for each release. In any case, this may be used by the feasibility analysis. If null, the default value will be new RelativeTime(0,0). Note that on a system with cost monitoring, this default value will allow no execution time for the associated schedulable object.
deadline - The deadline for the completion of one release, relative to the release time of that release. If null, the default value is a new instance of RelativeTime(period).
overrunHandler - This handler will be invoked if the cost of one invocation exceeds the cost parameter. If null, there will be no overrunHandler.

For JamaicaVM, cost overrun checking is enabled if CpuTime.CPU_TIME_SUPPORTED is true. The accuracy of the cost enforcement can be specified in nanoseconds via the property jamaica.cost_monitoring_accuracy. The default value is 5000000, i.e., 5milliseconds.

missHandler - This handler will be invoked if the deadline of one release is missed. If null, there will be no deadline miss handler.
Throws:
java.lang.IllegalArgumentException - if start is a negative RelativeTime, if the period is null or negative or zero, if cost is negative or deadline is negative or zero.
Method Detail

setIfFeasible

public boolean setIfFeasible(RelativeTime period,
                             RelativeTime cost,
                             RelativeTime deadline)
setIfFeasible performs a feasibility analysis using the new period, cost, and deadline parameters. If the resulting system remains feasible, the period, cost, and deadline will be set to the new values. This will change the corresponding attributes of all schedulable objects this is associated with.

Parameters:
period - The time between two periodic releases, in other words, the time interval between the return of two successive calls to waitForNextPeriod() or waitForNextPeriodInterruptible(). This argument must not be null or a time <= 0.
cost - The CPU time required for each release. If cost monitoring is performed, this gives the maximum amount of CPU time that will be allowed for each release. In any case, this may be used by the feasibility analysis. If null, the default value will be new RelativeTime(0,0). Note that on a system with cost monitoring, this default value will allow no execution time for the associated schedulable object.
deadline - The deadline for the completion of one release, relative to the release time of that release. If null, the default value is a new instance of RealtiveTime(Long.MAX_VALUE,999999).
Returns:
true if the change was performed and the resulting system is feasible. false if the change would result in an infeasible system and hence was not performed.
Throws:
java.lang.IllegalArgumentException - if the period is null or negative or zero, if cost is negative or deadline is negative or zero.

getStart

public HighResolutionTime getStart()
getStart returns the start time.

Returns:
the start time. Note that this is not necessarily the same HighResolutionTime object that was provided to the constructor or to setStart(), but it will represent the same value.

setStart

public void setStart(HighResolutionTime start)
setStart set the start time.

Parameters:
start - The time of the first release. If start is an instance of RelativeTime, its value will be used as the release time of the associated thread relative to the time the start() method of the thread will be called If an instance of class AbsoluteTime is passed, the associated thread will be released either at the time start() is called or at the time corresponding to the start parameter, whichever comes later. If null, the default value will be new RelativeTime(0,0).
Throws:
java.lang.IllegalArgumentException - if start is a negative RelativeTime.

getPeriod

public RelativeTime getPeriod()
getPeriod returns the current period.

Returns:
the period. Note that this is not necessarily the same RelativeTime object that was provided to the constructor or to setPeriod(), but it will represent the same value.

setPeriod

public void setPeriod(RelativeTime period)
setPeriod sets the period.

Parameters:
period - The time between two periodic releases, in other words, the time interval between the return of two successive calls to waitForNextPeriod() or waitForNextPeriodInterruptible(). This argument must not be null or a time <= 0.
Throws:
java.lang.IllegalArgumentException - if the period is null or negative or zero.

clone

public java.lang.Object clone()
clone creates a clone of this object with the same parameters but without association to any schedulable object. According to RTSJ 1.0.2, the cost, deadline, start, and period attributes are deep-copied, whereas the missHandler and overrunHandler attributes are only shallow-copied.

Overrides:
clone in class ReleaseParameters
Returns:
a new instance of PeriodicParameters with equal cost, deadline, start, and period attributes and copied references of the overrunHandler and missHandler attributes.
Since:
RTSJ V1.0.1

aicas logoJamaica 6.1 release 1

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