|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.realtime.Scheduler javax.realtime.PriorityScheduler
public class PriorityScheduler
Class which represents the required (by the RTSJ) priority-based scheduler. The default instance is the base scheduler which does fixed priority, preemptive scheduling.
This scheduler, like all schedulers, governs the default values for scheduling-related parameters in its client schedulable objects. The defaults are as follows:
Attribute |
Default Value |
---|---|
Priority parameters | |
Priority | norm priority |
Field Summary | |
---|---|
static int |
MAX_PRIORITY
Deprecated. 1.0.1 Use the getMaxPriority() method instead. |
static int |
MIN_PRIORITY
Deprecated. 1.0.1 Use the getMinPriority() method instead. |
Constructor Summary | |
---|---|
protected |
PriorityScheduler()
Construct an instance of PriorityScheduler . |
Method Summary | |
---|---|
protected boolean |
addToFeasibility(Schedulable schedulable)
Inform this scheduler and cooperating facilities that the resource demands of the given instance of Schedulable will be considered in the feasibility analysis of the associated Scheduler until further notice. |
void |
fireSchedulable(Schedulable schedulable)
Trigger the execution of a schedulable object (like an AsyncEventHandler ). |
int |
getMaxPriority()
Gets the maximum priority available for a schedulable object managed by this scheduler. |
static int |
getMaxPriority(java.lang.Thread thread)
Gets the maximum priority for the given thread. |
int |
getMinPriority()
Gets the minimum priority available for a schedulable object managed by this scheduler. |
static int |
getMinPriority(java.lang.Thread thread)
Gets the minimum priority for the given thread. |
int |
getNormPriority()
Gets the normal priority available for a schedulable object managed by this scheduler. |
static int |
getNormPriority(java.lang.Thread thread)
Gets the "norm" priority for the given thread. |
java.lang.String |
getPolicyName()
Gets the policy name of this . |
static PriorityScheduler |
instance()
Return a reference to the distinguished instance of PriorityScheduler which is the system's base
scheduler. |
boolean |
isFeasible()
Queries this scheduler about the feasibility of the set of schedulable objects currently in the feasibility set. |
protected boolean |
removeFromFeasibility(Schedulable schedulable)
Inform this scheduler and cooperating facilities that the resource demands of the given instance of Schedulable should no longer be considered in the feasibility analysis of the associated Scheduler. |
boolean |
setIfFeasible(Schedulable schedulable,
ReleaseParameters release,
MemoryParameters memory)
This method first performs a feasibility analysis using the proposed parameter objects as replacements for the current parameters of schedulable. |
boolean |
setIfFeasible(Schedulable schedulable,
ReleaseParameters release,
MemoryParameters memory,
ProcessingGroupParameters group)
This method first performs a feasibility analysis using the proposed parameter objects as replacements for the current parameters of schedulable. |
boolean |
setIfFeasible(Schedulable schedulable,
SchedulingParameters sched,
ReleaseParameters release,
MemoryParameters memory,
ProcessingGroupParameters group)
This method first performs a feasibility analysis using the proposed parameter objects as replacements for the current parameters of schedulable. |
Methods inherited from class javax.realtime.Scheduler |
---|
getDefaultScheduler, setDefaultScheduler |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAX_PRIORITY
getMaxPriority()
method instead.
public static final int MIN_PRIORITY
getMinPriority()
method instead.
Constructor Detail |
---|
protected PriorityScheduler()
PriorityScheduler
.
Applications will likely not need any instance other than the
default instance.
Method Detail |
---|
public static PriorityScheduler instance()
PriorityScheduler
which is the system's base
scheduler.
PriorityScheduler
.public int getMaxPriority()
public static int getMaxPriority(java.lang.Thread thread)
PriorityScheduler
, then
the maximum priority for that scheduler
is returned. If the given thread is a Java thread then
Thread.MAX_PRIORITY
is returned. Otherwise an
exception is thrown.
thread
- An instance of Thread
.
If null, the maximum priority of this scheduler
is returned.
thread
java.lang.IllegalArgumentException
- Thrown if thread
is a real-time
thread that is not scheduled by an instance of PriorityScheduler
.public int getMinPriority()
public static int getMinPriority(java.lang.Thread thread)
PriorityScheduler
, then
the minimum priority for that scheduler
is returned. If the given thread is a Java thread then
Thread.MIN_PRIORITY
is returned. Otherwise an
exception is thrown.
thread
- An instance of Thread
.
If null, the minimum priority of this scheduler
is returned.
thread
java.lang.IllegalArgumentException
- Thrown if thread
is a real-time
thread that is not scheduled by an instance of PriorityScheduler
.public int getNormPriority()
public static int getNormPriority(java.lang.Thread thread)
PriorityScheduler
, then
the norm priority for that scheduler
is returned. If the given thread is a Java thread then
Thread.NORM_PRIORITY
is returned. Otherwise an
exception is thrown.
thread
- An instance of Thread
.
If null, the norm priority for this scheduler
is returned.
thread
java.lang.IllegalArgumentException
- Thrown if thread
is a real-time
thread that is not scheduled by an instance3 of PriorityScheduler
.public boolean isFeasible()
Implementation Notes:
The default feasibility test for the PriorityScheduler considers a set of schedulable objects with bounded resource requirements, to always be feasible. This covers all schedulable objects with release parameters of types PeriodicParameters and SporadicParameters.
If any schedulable object within the feasibility set has release parameters of the exact type AperiodicParameters (not a subclass thereof), then the feasibility set is not feasible, as aperiodic release characteristics require unbounded resources. In that case, this method will return false and all methods in the setIfFeasible family of methods will also return false. Consequently, any call to a setIfFeasible method that passes a schedulable object which has release parameters of type AperiodicParameters, or passes proposed release parameters of type AperiodicParameters, will return false. The only time a setIfFeasible method can return true, when there exists in the feasibility set a schedulable object with release parameters of type AperiodicParameters, is when the method will change those release parameters to not be AperiodicParameters.
Implementations may provide a feasibility test other than the default test just described. In which case the details of that test should be documented here in place of this description of the default implementation.
isFeasible
in class Scheduler
public boolean setIfFeasible(Schedulable schedulable, ReleaseParameters release, MemoryParameters memory)
This method does not require that the schedulable object be in the feasibility set before it is called. If it is not initially a member of the feasibility set it will be added if the resulting system is feasible.
setIfFeasible
in class Scheduler
schedulable
- The schedulable object for which the changes are proposed.release
- The proposed release parameters. If null, the
default value of this scheduler is used (a new object is
created if the default value is not null). (See PriorityScheduler
.)memory
- The proposed memory parameters. If null, the
default value of this scheduler is used (a new object is
created if the default value is not null). (See PriorityScheduler
.)
java.lang.IllegalArgumentException
- Thrown if schedulable is null,
or schedulable is not associated with this scheduler, or the
proposed parameters are not compatible with this scheduler.
IllegalAssignmentError
- Thrown if schedulable cannot
hold references to the proposed parameter objects, or the
parameter objects cannot hold a reference to schedulable.
java.lang.IllegalThreadStateException
- Thrown if the new release parameters change
schedulable
from periodic scheduling to some other protocol and
schedulable
is currently
waiting for the next release
in RealtimeThread.waitForNextPeriod()
or RealtimeThread.waitForNextPeriodInterruptible()
.public boolean setIfFeasible(Schedulable schedulable, ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group)
This method does not require that the schedulable object be in the feasibility set before it is called. If it is not initially a member of the feasibility set it will be added if the resulting system is feasible.
setIfFeasible
in class Scheduler
schedulable
- The schedulable object for which the changes
are proposed.release
- The proposed release parameters. If null, the
default value of this scheduler is used (a new object is
created if the default value is not null). (See
PriorityScheduler.)memory
- The proposed memory parameters. If null, the
default value of this scheduler is used (a new object is
created if the default value is not null). (See PriorityScheduler
.)group
- The proposed processing group parameters. If null,
the default value of this scheduler is used (a new object is
created if the default value is not null). (See PriorityScheduler
.)
java.lang.IllegalArgumentException
- Thrown if schedulable is null,
or schedulable is not associated with this scheduler, or the
proposed parameters are not compatible with this scheduler.
IllegalAssignmentError
- Thrown if schedulable cannot
hold references to the proposed parameter objects, or the
parameter objects cannot hold a reference to schedulable.
java.lang.IllegalThreadStateException
- Thrown if the new release parameters change
schedulable
from periodic scheduling to some other protocol and
schedulable
is currently
waiting for the next release
in RealtimeThread.waitForNextPeriod()
or RealtimeThread.waitForNextPeriodInterruptible()
.public boolean setIfFeasible(Schedulable schedulable, SchedulingParameters sched, ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group)
This method does not require that the schedulable object be in the feasibility set before it is called. If it is not initially a member of the feasibility set it will be added if the resulting system is feasible.
setIfFeasible
in class Scheduler
schedulable
- The schedulable object for which the changes
are proposed.sched
- The proposed scheduling parameters. If null,
the default value of this scheduler is used (a new object is
created if the default value is not null). (See PriorityScheduler
.)release
- The proposed release parameters. If null, the
default value of this scheduler is used (a new object is
created if the default value is not null). (See PriorityScheduler
.)memory
- The proposed memory parameters. If null, the
default value of this scheduler is used (a new object is
created if the default value is not null). (See PriorityScheduler
.)group
- The proposed processing group parameters. If null,
the default value of this scheduler is used (a new object is
created if the default value is not null). (See PriorityScheduler
.)
java.lang.IllegalArgumentException
- Thrown if
schedulable is null, or schedulable is not associated with this
scheduler, or the proposed parameters are not compatible with
this scheduler.
IllegalAssignmentError
- Thrown if schedulable cannot
hold references to the proposed parameter objects, or the
parameter objects cannot hold a reference to schedulable.
java.lang.IllegalThreadStateException
- Thrown if the new
release parameters change schedulable from periodic scheduling
to some other protocol and schedulable is currently waiting for
the next release in RealtimeThread.waitForNextPeriod() or
RealtimeThread.waitForNextPeriodInterruptible().protected boolean addToFeasibility(Schedulable schedulable)
If the object is already included in the feasibility set, do nothing.
addToFeasibility
in class Scheduler
schedulable
- A reference to the given instance of Schedulable
java.lang.IllegalArgumentException
- Thrown if
schedulable
is null, or if schedulable is not
associated with this; that is schedulable.getScheduler()
!= this
.protected boolean removeFromFeasibility(Schedulable schedulable)
removeFromFeasibility
in class Scheduler
schedulable
- A reference to the given instance of Schedulable
java.lang.IllegalArgumentException
- Thrown if schedulable
is null.public void fireSchedulable(Schedulable schedulable)
AsyncEventHandler
).
fireSchedulable
in class Scheduler
schedulable
- The schedulable object to make active. If
null, nothing happens.
java.lang.UnsupportedOperationException
- Thrown in all cases by the PriorityScheduler
public java.lang.String getPolicyName()
this
.
getPolicyName
in class Scheduler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |