aicas logo Jamaica 3.4 release 8

javax.realtime
Class PeriodicParameters

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

public class PeriodicParameters
extends ReleaseParameters
implements Cloneable

Jamaica Realtime Specification for Java class PeriodicParameters.

This class characterizes the release of schedulable objects that are released regularly at constant intervals. Used as release parameters of 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 e PeriodicTimer. Note that for an AsyncEventHandler, the period 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 schudable 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 simulataneously 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
 Object clone()
          clone create 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 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 this will be used as release parameter for a RealtimeThread, a start time of class RelativeTime will be relative to the time method start() will be called on this thread. A start time of class AbsoluteTime will result in a release at that time start or immediately after a call to the thread's start() method if, whichever comes later. If null, the default value will be new RelativeTime(0,0).
period - The time between two periodic releases. If this will be associated with a RealtimeThread, then this give 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:
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. If this will be associated with a RealtimeThread, then this give 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:
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 this will be used as release parameter for a RealtimeThread, a start time of class RelativeTime will be relative to the time method start() will be called on this thread. A start time of class AbsoluteTime will result in a release at that time start or immediately after a call to the thread's start() method if, whichever comes later. If null, the default value will be new RelativeTime(0,0).
period - The time between two periodic releases. If this will be associated with a RealtimeThread, then this give 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(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:
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 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. If this will be associated with a RealtimeThread, then this give 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 was not performed.
Throws:
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 neccessarily 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 this will be used as release parameter for a RealtimeThread, a start time of class RelativeTime will be relative to the time method start() will be called on this thread. A start time of class AbsoluteTime will result in a release at that time start or immediately after a call to the thread's start() method if, whichever comes later. If null, the default value will be new RelativeTime(0,0).
Throws:
IllegalArgumentException - if start is a negative RelativeTime.

getPeriod

public RelativeTime getPeriod()
getPeriod returns the current period.

Returns:
the period. Note that this is not neccessarily 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. If this will be associated with a RealtimeThread, then this give 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:
IllegalArgumentException - if the period is null or negative or zero.

clone

public Object clone()
clone create a clone of this object with the same parameters but without association to any schedulable object

Overrides:
clone in class ReleaseParameters
Returns:
an new instance of PeriodicParameters with equal start, period, cost, deadline, overrunHandler and missHandler arguments.
Since:
RTSJ V1.0.1

aicas logo Jamaica 3.4 release 8

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2009 aicas GmbH. All Rights Reserved.