javax.realtime
Class SporadicParameters

java.lang.Object
  extended byjavax.realtime.ReleaseParameters
      extended byjavax.realtime.AperiodicParameters
          extended byjavax.realtime.SporadicParameters
All Implemented Interfaces:
java.lang.Cloneable

public class SporadicParameters
extends AperiodicParameters

A notice to the scheduler that the associated schedulable object's run method will be released aperiodically but with a minimum time between releases.

When a reference to a SporadicParameters object is given as a parameter to a schedulable object's constructor or passed as an argument to one of the schedulable object's setter methods, the SporadicParameters object becomes the release parameters object bound to that schedulable object. Changes to the values in the SporadicParameters object affect that schedulable object. If bound to more than one schedulable object then changes to the values in the SporadicParameters object affect all of the associated objects. Note that this is a one-to-many relationship and not a many-to-many.

The implementation must use modified copy semantics for each HighResolutionTime parameter value. The value of each time object should be treated as if it were copied at the time it is passed to the parameter object, but the object reference must also be retained. Only changes to a SporadicParameters object caused by methods on that object cause the change to propagate to all schedulable objects using the parameter object. For instance, calling setCost on a SporadicParameters object will make the change, then notify that the scheduler that the parameter object has changed. At that point the object is reconsidered for every SO that uses it. Invoking a method on the RelativeTime object that is the cost for this object may change the cost but it does not pass the change to the scheduler at that time. That change must not change the behavior of the SOs that use the parameter object until a setter method on the SporadicParameters object is invoked, or the parameter object is used in setReleaseParameters() or a constructor for an SO.

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

This class allows the application to specify one of four possible behaviors that indicate what to do if an arrival occurs that is closer in time to the previous arrival than the value given in this class as minimum interarrival time, what to do if, for any reason, the queue overflows, and the initial size of the queue.

Attribute
Value
minInterarrival time No default. A value must be supplied
cost new RelativeTime(0,0)
deadline new RelativeTime(mit)
overrunHandler None
missHandler None
MIT violation policy SAVE
Arrival queue overflow policy SAVE
Initial arrival queue length 0


Field Summary
static java.lang.String mitViolationExcept
          Represents the "EXCEPT" policy for dealing with minimum interarrival time violations.
static java.lang.String mitViolationIgnore
          Represents the "IGNORE" policy for dealing with minimum interarrival time violations.
static java.lang.String mitViolationReplace
          Represents the "REPLACE" policy for dealing with minimum interarrival time violations.
static java.lang.String mitViolationSave
          Represents the "SAVE" policy for dealing with minimum interarrival time violations.
 
Fields inherited from class javax.realtime.AperiodicParameters
arrivalTimeQueueOverflowExcept, arrivalTimeQueueOverflowIgnore, arrivalTimeQueueOverflowReplace, arrivalTimeQueueOverflowSave
 
Constructor Summary
SporadicParameters(RelativeTime minInterarrival)
          Create a SporadicParameters object.
SporadicParameters(RelativeTime minInterarrival, RelativeTime cost, RelativeTime deadline, AsyncEventHandler overrunHandler, AsyncEventHandler missHandler)
          Create a SporadicParameters object.
 
Method Summary
 RelativeTime getMinimumInterarrival()
          Gets the minimum interarrival time.
 java.lang.String getMitViolationBehavior()
          Gets the arrival time queue behavior in the event of a minimum interarrival time violation.
 boolean setIfFeasible(RelativeTime cost, RelativeTime deadline)
          This method first performs a feasibility analysis using the new cost, and deadline as replacements for the matching attributes of this.
 boolean setIfFeasible(RelativeTime interarrival, RelativeTime cost, RelativeTime deadline)
          This method first performs a feasibility analysis using the new interarrival, cost and deadline attributes as replacements for the matching attributes of this.
 void setMinimumInterarrival(RelativeTime minimum)
          Set the minimum interarrival time.
 void setMitViolationBehavior(java.lang.String behavior)
          Sets the behavior of the arrival time queue in the case where the new arrival time is closer to the previous arrival time than the minimum interarrival time given in this.
 
Methods inherited from class javax.realtime.AperiodicParameters
getArrivalTimeQueueOverflowBehavior, getInitialArrivalTimeQueueLength, setArrivalTimeQueueOverflowBehavior, setDeadline, setInitialArrivalTimeQueueLength
 
Methods inherited from class javax.realtime.ReleaseParameters
clone, getCost, getCostOverrunHandler, getDeadline, getDeadlineMissHandler, setCost, setCostOverrunHandler, setDeadlineMissHandler
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mitViolationExcept

public static final java.lang.String mitViolationExcept
Represents the "EXCEPT" policy for dealing with minimum interarrival time violations. Under this policy, if an arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters occurs at a time less then the minimum interarrival time defined here then the fire() method shall throw MITViolationException. Any other associated semantics are governed by the schedulers for the schedulable objects using these sporadic parameters. If the arrival time is a result of a happening to which the instance of AsyncEventHandler is bound then the arrival time is ignored.

See Also:
Constant Field Values

mitViolationIgnore

public static final java.lang.String mitViolationIgnore
Represents the "IGNORE" policy for dealing with minimum interarrival time violations. Under this policy, if an arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters occurs at a time less then the minimum interarrival time defined here then the new arrival time is ignored. Any other associated semantics are governed by the schedulers for the schedulable objects using these sporadic parameters.

See Also:
Constant Field Values

mitViolationSave

public static final java.lang.String mitViolationSave
Represents the "SAVE" policy for dealing with minimum interarrival time violations. Under this policy the arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters is not compared to the specified minimum interarrival time. Any other associated semantics are governed by the schedulers for the schedulable objects using these sporadic parameters.

See Also:
Constant Field Values

mitViolationReplace

public static final java.lang.String mitViolationReplace
Represents the "REPLACE" policy for dealing with minimum interarrival time violations. Under this policy if an arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters occurs at a time less then the minimum interarrival time defined here then the information for this arrival replaces a previous arrival. Any other associated semantics are governed by the schedulers for the schedulable objects using these sporadic parameters.

See Also:
Constant Field Values
Constructor Detail

SporadicParameters

public SporadicParameters(RelativeTime minInterarrival)
Create a SporadicParameters object. This constructor is equivalent to:
SporadicParameters(minInterarrival, null, null, null, null)

Parameters:
minInterarrival - The release times of the schedulable object will occur no closer than this interval. This time object is treated as if it were copied. Changes to minInterarrival will not effect the SporadicParameters object. There is no default value. If minInterarrival is null an illegal argument exception is thrown.
Throws:
java.lang.IllegalArgumentException - Thrown if minInterarrival is null or its time value is not greater than zero.
IllegalAssignmentError - Thrown if minInterarrival cannot be stored in this.
Since:
1.0.1

SporadicParameters

public SporadicParameters(RelativeTime minInterarrival,
                          RelativeTime cost,
                          RelativeTime deadline,
                          AsyncEventHandler overrunHandler,
                          AsyncEventHandler missHandler)
Create a SporadicParameters object.

Parameters:
minInterarrival - The release times of the schedulable object will occur no closer than this interval. This time object is treated as if it were copied. Changes to minInterarrival will not effect the SporadicParameters object. There is no default value. If minInterarrival is null an illegal argument exception is thrown.
cost - Processing time per release. 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 release. 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 cost. If null, the default value is a new instance of RelativeTime(0,0).
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 minimum interarrival interval. Other implementations may use this parameter to compute execution eligibility. If null, the default value is a new instance of RelativeTime(mit).
overrunHandler - This handler is invoked if an invocation of the schedulable object exceeds cost. Not required for minimum implementation. If null no overrun handler will be used.
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, no deadline miss handler will be used.
Throws:
java.lang.IllegalArgumentException - Thrown if minInterarrival is null or its time value is not greater than zero, or the time value of cost is less than zero, or the time value of deadline is not greater than zero.
IllegalAssignmentError - Thrown if minInterarrival, cost, deadline, overrunHandler or missHandler cannot be stored in this.
Method Detail

setMitViolationBehavior

public void setMitViolationBehavior(java.lang.String behavior)
Sets the behavior of the arrival time queue in the case where the new arrival time is closer to the previous arrival time than the minimum interarrival time given in this.

Parameters:
behavior - A string representing the behavior.
Throws:
java.lang.IllegalArgumentException - Thrown if behavior is not one of the final MIT violation behavior values defined in this class.

getMitViolationBehavior

public java.lang.String getMitViolationBehavior()
Gets the arrival time queue behavior in the event of a minimum interarrival time violation.

Returns:
The minimum interarrival time violation behavior as a string.

setIfFeasible

public boolean setIfFeasible(RelativeTime cost,
                             RelativeTime deadline)
This method first performs a feasibility analysis using the new cost, and deadline as replacements for the matching attributes of this. If the resulting system is feasible, the method replaces the current scheduling characteristics, of this with the new scheduling characteristics.

Overrides:
setIfFeasible in class AperiodicParameters
Parameters:
cost - The proposed cost. to determine when any particular object exceeds cost. If null, the default value is a new instance of RelativeTime(0,0).
deadline - The proposed deadline. If null, the default value is a new instance of RelativeTime(mit).
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.
Throws:
java.lang.IllegalArgumentException - Thrown if the time value of cost is less than zero, or the time value of deadline is less than or equal to zero, or the values are incompatible with the scheduler for any of the schedulable objects which are presently using this parameter object.
IllegalAssignmentError - Thrown if cost or deadline cannot be stored in this.

setIfFeasible

public boolean setIfFeasible(RelativeTime interarrival,
                             RelativeTime cost,
                             RelativeTime deadline)
This method first performs a feasibility analysis using the new interarrival, cost and deadline attributes as replacements for the matching attributes of this. If the resulting system is feasible the method replaces the current attributes with the new ones.

Changes to a SporadicParameters instance effect subsequent arrivals.

Parameters:
interarrival - The proposed interarrival time. There is no default value. If minInterarrival is null an illegal argument exception is thrown.
cost - The proposed cost. If null, the default value is a new instance of RelativeTime(0,0).
deadline - The proposed deadline. If null, the default value is a new instance of RelativeTime(mit).
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.
Throws:
java.lang.IllegalArgumentException - Thrown if minInterarrival is null or its time value is not greater than zero, or the time value of cost is less than zero, or the time value of deadline is not greater than zero.
IllegalAssignmentError - Thrown if interarrival, cost or deadline cannot be stored in this.

getMinimumInterarrival

public RelativeTime getMinimumInterarrival()
Gets the minimum interarrival time.

Returns:
The minimum interarrival time.

setMinimumInterarrival

public void setMinimumInterarrival(RelativeTime minimum)
Set the minimum interarrival time.

Parameters:
minimum - The release times of the schedulable object will occur no closer than this interval.
Throws:
java.lang.IllegalArgumentException - Thrown if minimum is null or its time value is not greater than zero.
IllegalAssignmentError - Thrown if minimum cannot be stored in this.