javax.realtime
Class SporadicParameters

java.lang.Object
  extended byjavax.realtime.ReleaseParameters
      extended byjavax.realtime.AperiodicParameters
          extended byjavax.realtime.SporadicParameters
All Implemented Interfaces:
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 constructor, the SporadicParameters object becomes bound to the object being created. Changes to the values in the SporadicParameters object affect the constructed object. If given to more than one constructor, 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.

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.

Correct initiation of the deadline miss and cost overrun handlers requires that the underlying system know the arrival time of each sporadic task. For an instance of RealtimeThread the arrival time is the time at which the RealtimeThread.start() is invoked. For other instances of Schedulable it may be required for the implementation to save the arrival times. For instances of AsyncEventHandler with a ReleaseParameters type of SporadicParameters the implementation must maintain a queue of monotonically increasing arrival times which correspond to the execution of the fire() method of the instance of AsyncEvent bound to the instance of AsyncEventHandler.

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.

Author:
Angelo Corsaro, Morgan Deters

Field Summary
static String mitViolationExcept
          If an arrival time for any instance of Schedulable41 which has this as its instance of ReleaseParameters occurs at a time less then the mini-mum interarrival time defined here then the fire() method shall throw MITViolationException.
static String mitViolationIgnore
          If an arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters occurs at a time less then the mini-mum interarrival time defined here then the new arrival time is ignored.
static String mitViolationReplace
          If an arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters occurs at a time less then the mini-mum interarrival time defined here then, if necessary, the previous arrival time may be overwritten with the new arrival time.
static String mitViolationSave
          If an arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters occurs at a time less then the mini-mum interarrival time defined here then the new arrival time is added to the queue of arrival times.
 
Fields inherited from class javax.realtime.AperiodicParameters
arrivalTimeQueueOverflowExcept, arrivalTimeQueueOverflowIgnore, arrivalTimeQueueOverflowReplace, arrivalTimeQueueOverflowSave
 
Fields inherited from class javax.realtime.ReleaseParameters
cost, deadline, missHandler, overrunHandler
 
Constructor Summary
SporadicParameters(RelativeTime minInterarrival)
          Create a SporadicParameters object.
SporadicParameters(RelativeTime mit, RelativeTime cost, RelativeTime deadline, AsyncEventHandler overrunHandler, AsyncEventHandler missHandler)
          Creates a new SporadicParameters instance.
 
Method Summary
 RelativeTime getMinimumInterarrival()
          Get the minimum interarrival time.
 String getMitViolationBehavior()
          Get the arrival time queue behavior in the event of a minimum interarrival time violation.
 boolean setIfFeasible(RelativeTime cost, RelativeTime deadline)
          Returns true if, after considering the values of the parameters, the task set would still be feasible.
 boolean setIfFeasible(RelativeTime interarrival, RelativeTime cost, RelativeTime deadline)
          Returns true if, after considering the values of the parameters, the task set would still be feasible.
 void setMinimumInterarrival(RelativeTime mit)
          Set the minimum interarrival time.
 void setMitViolationBehavior(String behavior)
          Set the arrival time queue behavior in the event of a minimum interarrival time violation.
 
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 String mitViolationExcept
If an arrival time for any instance of Schedulable41 which has this as its instance of ReleaseParameters occurs at a time less then the mini-mum interarrival time defined here then the fire() method shall throw MITViolationException. If the arrival time is a result of a happen-ing to which the instance of AsyncEventHandler is bound then the arrival time is ignored.

See Also:
Constant Field Values

mitViolationIgnore

public static final String mitViolationIgnore
If an arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters occurs at a time less then the mini-mum interarrival time defined here then the new arrival time is ignored.

See Also:
Constant Field Values

mitViolationReplace

public static final String mitViolationReplace
If an arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters occurs at a time less then the mini-mum interarrival time defined here then, if necessary, the previous arrival time may be overwritten with the new arrival time.

See Also:
Constant Field Values

mitViolationSave

public static final String mitViolationSave
If an arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters occurs at a time less then the mini-mum interarrival time defined here then the new arrival time is added to the queue of arrival times. However, the new time is adjusted so that the differ-ence between it and the previous time is equal to the minimum interarrival time.

See Also:
Constant Field Values
Constructor Detail

SporadicParameters

public SporadicParameters(RelativeTime mit,
                          RelativeTime cost,
                          RelativeTime deadline,
                          AsyncEventHandler overrunHandler,
                          AsyncEventHandler missHandler)
Creates a new SporadicParameters instance.

Implementation Note: By default the Queue Overflow, and the Minimum Interarrival Time Violation are set to save.

Parameters:
mit - The release times of the schedulable object will occur no closer than this interval. Must be greater than zero when entering feasibility analysis.
cost - Processing time per minimum interarrival interval. 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 interval. 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. 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 minimum interarrival interval. Other implementations may use this parameter to compute execution eligibility. If null, deadline will equal the minimum interarrival time.
overrunHandler - This handler is invoked if an invocation of the schedulable object exceeds cost. 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.
Throws:
IllegalArgumentException - if minInterarrival is null or less than zero
IllegalAssignmentError - if minInterarrival cannot be stored in this

SporadicParameters

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

Parameters:
minInterarrival - the minimum interarrival time
Throws:
IllegalArgumentException - if minInterarrival is null or less than zero
IllegalAssignmentError - if minInterarrival cannot be stored in this
Method Detail

getMinimumInterarrival

public RelativeTime getMinimumInterarrival()
Get the minimum interarrival time.

Returns:
the minimum interarrival time.

setMinimumInterarrival

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

Parameters:
mit - The release times of the schedulable object will occur no closer than this interval. Must be greater than zero when entering feasibility analysis.
Throws:
IllegalArgumentException - if mit is null or its time value is less than zero
IllegalAssignmentError - if mit cannot be stored in this

getMitViolationBehavior

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

Returns:
the arrival time queue behavior

setMitViolationBehavior

public void setMitViolationBehavior(String behavior)
Set the arrival time queue behavior in the event of a minimum interarrival time violation.

Parameters:
behavior - the arrival time queue behavior
Throws:
IllegalArgumentException - if behavior is not one of the valid behaviors defined in this class

setIfFeasible

public boolean setIfFeasible(RelativeTime interarrival,
                             RelativeTime cost,
                             RelativeTime deadline)
Returns true if, after considering the values of the parameters, the task set would still be feasible. In this case the values of the parameters are changed. Returns false if, after considering the values of the parameters, the task set would not be feasible. In this case the values of the parameters are not changed.

Parameters:
interarrival - The release times of the schedulable object will occur no closer than this interval. Must be greater than zero when entering feasibility analysis.
cost - Processing time per minimum interarrival interval. 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 interval. 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. 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 minimum interarrival interval. Other implementations may use this parameter to compute execution eligibility. If null, deadline will equal the minimum interarrival time.
Returns:
true if the new parameters can be changed while keeping the schedule feasible
Throws:
IllegalArgumentException - if interarrival is null or nonpositive, if cost is negative, or if deadline is nonpositive
IllegalAssignmentError - if one or more of the arguments cannot be referred to by this; in this case, no changes are made, even for those parameters that can be stored in this

setIfFeasible

public boolean setIfFeasible(RelativeTime cost,
                             RelativeTime deadline)
Returns true if, after considering the values of the parameters, the task set would still be feasible. In this case the values of the parameters are changed. Returns false if, after considering the values of the parameters, the task set would not be feasible. In this case the values of the parameters are not changed.

Overrides:
setIfFeasible in class AperiodicParameters
Parameters:
cost - Processing time per minimum interarrival interval. 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 interval. 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. 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 minimum interarrival interval. Other implementations may use this parameter to compute execution eligibility. If null, deadline will equal the minimum interarrival time.
Returns:
true if the new parameters can be changed while keeping the schedule feasible


jRate is developed and maintained by the jRate project development team.
Copyright (c) 2001-2006 Angelo Corsaro and Morgan Deters.