javax.realtime
Class PeriodicParameters

java.lang.Object
  |
  +--javax.realtime.ReleaseParameters
        |
        +--javax.realtime.PeriodicParameters

public class PeriodicParameters
extends ReleaseParameters

This release parameter indicates that the waitForNextPeriod() method on the associated Schedulable object will be unblocked at the start of each period. When a reference to a PeriodicParameters object is given as a parameter to a constructor, the PeriodicParameters object becomes bound to the object being created. Changes to the values in the PeriodicParameters object affect the constructed object. If given to more than one constructor then changes to the values in the PeriodicParameters object affect all the associated objects. Note that this is a one-to-many relationship, not many-to-many.

Caution: This class is explicitly unsafe in multithreaded situations when it is being changed. No synchronizations is done. It is assumed that users of this class who are mutating instances will be doing their own synchronization at a higher level.


Field Summary
(package private)  javax.realtime.RelativeTime period
           
(package private)  java.util.LinkedList schList
           
(package private)  javax.realtime.HighResolutionTime start
           
 
Fields inherited from class javax.realtime.ReleaseParameters
cost, deadline, missHandler, overrunHandler
 
Constructor Summary
PeriodicParameters(javax.realtime.HighResolutionTime start, javax.realtime.RelativeTime period, javax.realtime.RelativeTime cost, javax.realtime.RelativeTime deadline, javax.realtime.AsyncEventHandler overrunHandler, javax.realtime.AsyncEventHandler missHandler)
          Create a PeriodicParameters object.
 
Method Summary
 boolean bindSchedulable(javax.realtime.Schedulable sch)
          Informs this that there is one more instance of Schedulable that uses this as its ReleaseParameters.
 javax.realtime.RelativeTime getPeriod()
          Gets the period.
 javax.realtime.HighResolutionTime getStart()
          Gets the start time.
 boolean setIfFeasible(javax.realtime.RelativeTime period, javax.realtime.RelativeTime cost, javax.realtime.RelativeTime deadline)
          This method appears in many classes in the RTSJ and with various parameters.
 void setPeriod(javax.realtime.RelativeTime period)
          Sets the period.
 void setStart(javax.realtime.HighResolutionTime start)
          Sets the start time.
 boolean unbindSchedulable(javax.realtime.Schedulable sch)
          Informs this that Schedulable sch that uses this as its ReleaseParameters.
 
Methods inherited from class javax.realtime.ReleaseParameters
getCost, getCostOverrunHandler, getDeadline, getDeadlineMissHandler, setCost, setCostOverrunHandler, setDeadline, setDeadlineMissHandler, setIfFeasible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

start

javax.realtime.HighResolutionTime start

period

javax.realtime.RelativeTime period

schList

java.util.LinkedList schList
Constructor Detail

PeriodicParameters

public PeriodicParameters(javax.realtime.HighResolutionTime start,
                          javax.realtime.RelativeTime period,
                          javax.realtime.RelativeTime cost,
                          javax.realtime.RelativeTime deadline,
                          javax.realtime.AsyncEventHandler overrunHandler,
                          javax.realtime.AsyncEventHandler missHandler)
Create a PeriodicParameters object.

Parameters:
start - Time at which the first period begins. If a RelativeTime, this time is relative to the first time the schedulable object becomes schedulable (schedulable time) (e.g., when start() is called on a thread). If an AbsoluteTime and it is before the schedulable time, start is equivalent to the schedulable time.
period - The period is the interval between successive unblocks of RealtimeThread.waitForNextPeriod(). Must be greater than zero when entering feasibility analysis.
cost - Processing time per period. On implementations which can measure the amount of time a schedulable object is executed, this value is the maximum amount of time a schedulable object receives per period. On implementations which cannot measure execution time, this value is used as a hint to the feasibility algorithm. On such systems it is not possible to determine when any particular object exceeds or will exceed cost time units in a period. Equivalent to RelativeTime(0, 0) if null.
deadline - The latest permissible completion time measured from the release time of the associated invocation of the schedulable object. For a minimum implementation for purposes of feasibility analysis, the deadline is equal to the period. Other implementations may use this parameter to compute execution eligibility. If null, deadline will equal the period.
overrunHandler - This handler is invoked if an invocation of the schedulable object exceeds cost in the given period. Not required for minimum implementation. If null, nothing happens on the overrun condition.
missHandler - This handler is invoked if the run() method of the schedulable object is still executing after the deadline has passed. Although minimum implementations do not consider deadlines in feasibility calculations, they must recognize variable deadlines and invoke the miss handler as appropriate. If null, nothing happens on the miss deadline condition.
Method Detail

getPeriod

public javax.realtime.RelativeTime getPeriod()
Gets the period.

Returns:
The current value in period.

getStart

public javax.realtime.HighResolutionTime getStart()
Gets the start time.

Returns:
The current value in start.

setIfFeasible

public boolean setIfFeasible(javax.realtime.RelativeTime period,
                             javax.realtime.RelativeTime cost,
                             javax.realtime.RelativeTime deadline)
This method appears in many classes in the RTSJ and with various parameters. The parameters are either new scheduling characteristics for an instance Schedulable or an instance of Schedulable. The method first performs a feasibility analysis using the new scheduling characteristics as replacements for the matching scheduling characteristics of either this or the given instance of Schedulable. If the resulting system is feasible the method replaces the current scheduling characteristics, of either this or the given instance of Schedulable as appropriate, with the new scheduling characteristics.

Parameters:
period - The proposed period.
cost - The proposed cost.
deadline - The proposed deadline.
Returns:
True, if the resulting system is feasible and the changes are made. False, if the resulting system is not feasible and no changes are made.

setPeriod

public void setPeriod(javax.realtime.RelativeTime period)
Sets the period.

Parameters:
period - The value to which period is set.

setStart

public void setStart(javax.realtime.HighResolutionTime start)
Sets the start time.

Parameters:
start - The value to which start is set.

bindSchedulable

public boolean bindSchedulable(javax.realtime.Schedulable sch)
Informs this that there is one more instance of Schedulable that uses this as its ReleaseParameters.

Overrides:
bindSchedulable in class ReleaseParameters

unbindSchedulable

public boolean unbindSchedulable(javax.realtime.Schedulable sch)
Informs this that Schedulable sch that uses this as its ReleaseParameters.

Overrides:
unbindSchedulable in class ReleaseParameters