javax.realtime
Class SporadicParameters

java.lang.Object
  |
  +--javax.realtime.ReleaseParameters
        |
        +--javax.realtime.AperiodicParameters
              |
              +--javax.realtime.SporadicParameters

public class SporadicParameters
extends AperiodicParameters

A notice to the scheduler that the associated schedulable object's run method witll be released aperiodically but with a minimum time between releases. When a reference toa 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 require 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 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 incraesing 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.


Field Summary
private  java.lang.String arrivalTimeQueueOverflowBehavior
           
static java.lang.String arrivalTimeQueueOverflowExcept
          If an arrival time occurs and should be queued but the queue already holds a number of times equal to the initial queue length defined by this then the fire() method shall throw a ResourceLimitError.
static java.lang.String arrivalTimeQueueOverflowIgnore
          If an arrival time occurs and should be queued but the queue already holds a number of times equal to the initial queue length defined by this then the arrival time is ignored.
static java.lang.String arrivalTimeQueueOverflowReplace
          If an arrival time occurs and should be queued but the queue already holds a number of times equal to the initial queue length defined by this then the previous arrival time is overwritten by the new arrival time.
static java.lang.String arrivalTimeQueueOverflowSave
          If an arrival time occurs and should be queued but the queue already holds a number of times equal to the initial queue length defined by this then the queue is lengthened and the arrival time is saved.
private  int initialArrivalTimeQueueLength
           
private  javax.realtime.RelativeTime minInterarrival
           
private  java.lang.String mitViolationBehavior
           
static java.lang.String mitViolationExcept
          If an arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters occurs at a time les then the minimum interarrival time defined here then the fire() method shall throw MITViolationException.
static java.lang.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 minimum interarrival time defined here then the new arrival time is ignored.
static java.lang.String mitViolationReplace
          If an arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters occurs at a time less than the minimum interarrival time defined here then the previous arrival time is overwritten with the new arrival time.
static java.lang.String mitViolationSave
          If an arrival time for any instance of Schedulble 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 added to the queue of arrival times.
(package private)  javax.realtime.Schedulable sch
           
 
Fields inherited from class javax.realtime.AperiodicParameters
schList
 
Fields inherited from class javax.realtime.ReleaseParameters
cost, deadline, missHandler, overrunHandler
 
Constructor Summary
SporadicParameters(javax.realtime.RelativeTime minInterarrival, javax.realtime.RelativeTime cost, javax.realtime.RelativeTime deadline, javax.realtime.AsyncEventHandler overrunHandler, javax.realtime.AsyncEventHandler missHandler)
          Create a SporadicParameters 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.
 java.lang.String getArrivalTimeQueueOverflowBeharior()
          Get the behavior of the arrival time queue in the event of an overflow.
 int getInitialArrivalTimeQueueLength()
          Get the initial number of elements the arrival time queue can hold.
 javax.realtime.RelativeTime getMinimumInterarrival()
          Get the minimum interarrival time.
 java.lang.String getMitViolationBehavior()
          Get the arrival time queue behavior in the event of a minimum interarrival time violation.
 void setArrivalTimeQueueOverflowBehavior(java.lang.String behavior)
          Set the behavior of the arrival time queue in the case where the insertion of a new element would make the queue size greater than the initial size given in this.
 boolean setIfFeasible(javax.realtime.RelativeTime interarrival, javax.realtime.RelativeTime cost, javax.realtime.RelativeTime deadline)
          This method appears in many classes in the RTSJ and with varous parameters.
 void setInitialArrivalTimeQueueLength(int initial)
          Set the initial number of elements the arrival time queue can hold without lengthening the queue.
 void setMinimumInterarrival(javax.realtime.RelativeTime minInterarrival)
          Set the minimum interarrival time.
 void setMitViolationBehavior(java.lang.String behavior)
          Set 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.
 boolean unbindSchedulable(javax.realtime.Schedulable sch)
          Informs this that Schedulable sch that uses this as its ReleaseParameters.
 
Methods inherited from class javax.realtime.AperiodicParameters
setIfFeasible
 
Methods inherited from class javax.realtime.ReleaseParameters
getCost, getCostOverrunHandler, getDeadline, getDeadlineMissHandler, setCost, setCostOverrunHandler, setDeadline, setDeadlineMissHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

minInterarrival

private javax.realtime.RelativeTime minInterarrival

arrivalTimeQueueOverflowBehavior

private java.lang.String arrivalTimeQueueOverflowBehavior

initialArrivalTimeQueueLength

private int initialArrivalTimeQueueLength

mitViolationBehavior

private java.lang.String mitViolationBehavior

sch

javax.realtime.Schedulable sch

arrivalTimeQueueOverflowExcept

public static final java.lang.String arrivalTimeQueueOverflowExcept
If an arrival time occurs and should be queued but the queue already holds a number of times equal to the initial queue length defined by this then the fire() method shall throw a ResourceLimitError. 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

arrivalTimeQueueOverflowIgnore

public static final java.lang.String arrivalTimeQueueOverflowIgnore
If an arrival time occurs and should be queued but the queue already holds a number of times equal to the initial queue length defined by this then the arrival time is ignored.

See Also:
Constant Field Values

arrivalTimeQueueOverflowReplace

public static final java.lang.String arrivalTimeQueueOverflowReplace
If an arrival time occurs and should be queued but the queue already holds a number of times equal to the initial queue length defined by this then the previous arrival time is overwritten by the new arrival time. However, the new time is adjusted so that the difference between it and the previous time is equal to the minimum intearrival time.

See Also:
Constant Field Values

arrivalTimeQueueOverflowSave

public static final java.lang.String arrivalTimeQueueOverflowSave
If an arrival time occurs and should be queued but the queue already holds a number of times equal to the initial queue length defined by this then the queue is lengthened and the arrival time is saved.

See Also:
Constant Field Values

mitViolationExcept

public static final java.lang.String mitViolationExcept
If an arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters occurs at a time les then the minimum interarrival time defined here then the fire() method shall throw MITViolationException. 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
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.

See Also:
Constant Field Values

mitViolationReplace

public static final java.lang.String mitViolationReplace
If an arrival time for any instance of Schedulable which has this as its instance of ReleaseParameters occurs at a time less than the minimum interarrival time defined here then the previous arrival time is overwritten with the new arrival time.

See Also:
Constant Field Values

mitViolationSave

public static final java.lang.String mitViolationSave
If an arrival time for any instance of Schedulble 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 added to the queue of arrival times. However, the new time is adjusted so that the difference between it and the previous time is equal to the minimum interarrival time.

See Also:
Constant Field Values
Constructor Detail

SporadicParameters

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

Parameters:
minInterarrival - The release times of the schedulable object will occur no closer that 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 s a hint to the feasibility altorithm. 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 anaysis, 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.
Method Detail

getArrivalTimeQueueOverflowBeharior

public java.lang.String getArrivalTimeQueueOverflowBeharior()
Get the behavior of the arrival time queue in the event of an overflow.

Returns:
The behavior of the arrival time queue as a string.

getInitialArrivalTimeQueueLength

public int getInitialArrivalTimeQueueLength()
Get the initial number of elements the arrival time queue can hold.

Returns:
The initial length of the queue.

getMinimumInterarrival

public javax.realtime.RelativeTime getMinimumInterarrival()
Get the minimum interarrival time.

Returns:
The minimum interarrival time.

getMitViolationBehavior

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

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

setArrivalTimeQueueOverflowBehavior

public void setArrivalTimeQueueOverflowBehavior(java.lang.String behavior)
Set the behavior of the arrival time queue in the case where the insertion of a new element would make the queue size greater than the initial size given in this.

Parameters:
behavior - A string representing the behavior.

setInitialArrivalTimeQueueLength

public void setInitialArrivalTimeQueueLength(int initial)
Set the initial number of elements the arrival time queue can hold without lengthening the queue.

Parameters:
initial - The initial length of the queue.

setMinimumInterarrival

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

Parameters:
minInterarrival - The release times of the schedulable object will occur no closer than this interval. Must be greater than zero when entering feasibility analysis.

setMitViolationBehavior

public void setMitViolationBehavior(java.lang.String behavior)
Set 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.

setIfFeasible

public boolean setIfFeasible(javax.realtime.RelativeTime interarrival,
                             javax.realtime.RelativeTime cost,
                             javax.realtime.RelativeTime deadline)
This method appears in many classes in the RTSJ and with varous 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 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:
interarrival - The proposed interarrival time.
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.

bindSchedulable

public boolean bindSchedulable(javax.realtime.Schedulable sch)
Description copied from class: AperiodicParameters
Informs this that there is one more instance of Schedulable that uses this as its ReleaseParameters.

Overrides:
bindSchedulable in class AperiodicParameters

unbindSchedulable

public boolean unbindSchedulable(javax.realtime.Schedulable sch)
Description copied from class: AperiodicParameters
Informs this that Schedulable sch that uses this as its ReleaseParameters.

Overrides:
unbindSchedulable in class AperiodicParameters