public abstract class PriorityScheduler extends Scheduler
This scheduler, like all schedulers, governs the default values for scheduling-related parameters in its client schedulables. The defaults are as follows:
Attribute |
Default Value |
---|---|
Priority | norm priority |
Note that the system contains by default one instance of
PriorityScheduler
, which is the system's base scheduler
and is returned by FirstInFirstOutScheduler.instance()
,
so a subclass of PriorityScheduler.
It may, however, contain other instances of subclasses of
PriorityScheduler
created through this class'
protected constructor. The instance returned by the
FirstInFirstOutScheduler.instance()
method, the
base scheduler, is also returned by
Scheduler.getDefaultScheduler()
unless the default scheduler
is changed with Scheduler.setDefaultScheduler(Scheduler)
.
Modifier | Constructor and Description |
---|---|
protected |
PriorityScheduler()
Constructs an instance of
PriorityScheduler . |
Modifier and Type | Method and Description |
---|---|
protected boolean |
addToFeasibility(Schedulable schedulable)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis is inadequate
|
protected SchedulingParameters |
createDefaultSchedulingParameters()
Create a default
SchedulingParameters instance for this
schedulers. |
void |
fireSchedulable(Schedulable schedulable)
Deprecated.
RTSJ 2.0
|
abstract int |
getMaxPriority()
Gets the maximum priority available for a schedulable
managed by this scheduler.
|
static int |
getMaxPriority(java.lang.Thread thread)
Deprecated.
since RTSJ 2.0
|
abstract int |
getMinPriority()
Gets the minimum priority available for a schedulable
managed by this scheduler.
|
static int |
getMinPriority(java.lang.Thread thread)
Deprecated.
since RTSJ 2.0
|
abstract int |
getNormPriority()
Gets the normal priority available for a schedulable managed
by this scheduler.
|
static int |
getNormPriority(java.lang.Thread thread)
Deprecated.
since RTSJ 2.0
|
java.lang.String |
getPolicyName()
Gets the policy name of
this . |
static PriorityScheduler |
instance()
Deprecated.
since RTSJ 2.0
|
boolean |
isFeasible()
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis is inadequate
|
protected boolean |
removeFromFeasibility(Schedulable schedulable)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis
is inadequate
|
boolean |
setIfFeasible(Schedulable schedulable,
ReleaseParameters<?> release,
MemoryParameters memory)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis
is inadequate
|
boolean |
setIfFeasible(Schedulable schedulable,
ReleaseParameters<?> release,
MemoryParameters memory,
ProcessingGroupParameters group)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis
is inadequate
|
boolean |
setIfFeasible(Schedulable schedulable,
SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory,
ProcessingGroupParameters group)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis
is inadequate
|
currentSchedulable, getDefaultScheduler, inSchedulableExecutionContext, reschedule, setDefaultScheduler
protected PriorityScheduler()
PriorityScheduler
.
Applications will likely not need any instance other than the
default instance.public java.lang.String getPolicyName()
this
.getPolicyName
in class Scheduler
public abstract int getMaxPriority()
public abstract int getMinPriority()
public abstract int getNormPriority()
protected SchedulingParameters createDefaultSchedulingParameters()
Scheduler
SchedulingParameters
instance for this
schedulers. A scheduler must define this in order to support
setting Schedulable.setSchedulingParameters(javax.realtime.SchedulingParameters)
with
null
as its parameter. Otherwise, null is not allowed.createDefaultSchedulingParameters
in class Scheduler
@Deprecated public static int getMaxPriority(java.lang.Thread thread)
PriorityScheduler
, then the maximum priority for that
scheduler is returned. When the given thread is not an instance of
Schedulable
, the maximum priority of its thread group is
returned. Otherwise an exception is thrown.thread
- An instance of Thread
.
When null
, the maximum priority of this scheduler
is returned.thread
StaticIllegalArgumentException
- when thread
is a
realtime thread that is not scheduled by an instance of
PriorityScheduler
.@Deprecated public static int getMinPriority(java.lang.Thread thread)
PriorityScheduler
, then the minimum priority for that
scheduler is returned. When the given thread is not an instance of
Schedulable
, Thread.MIN_PRIORITY
is
returned. Otherwise an exception is thrown.thread
- An instance of Thread
.
When null
, the minimum priority of this scheduler
is returned.thread
StaticIllegalArgumentException
- when thread
is a
realtime thread that is not scheduled by an instance of
PriorityScheduler
.@Deprecated public static int getNormPriority(java.lang.Thread thread)
PriorityScheduler
, then the norm priority for that
scheduler is returned. When the given thread is not an instance of
Schedulable
, Thread.NORM_PRIORITY
is
returned. Otherwise an exception is thrown.thread
- An instance of Thread
.
When null
, the norm priority for this scheduler
is returned.thread
StaticIllegalArgumentException
- when thread
is a
realtime thread that is not scheduled by an instance3 of
PriorityScheduler
.@Deprecated public static PriorityScheduler instance()
PriorityScheduler
, which is the system's base
scheduler.PriorityScheduler
.@Deprecated public boolean isFeasible()
Scheduler
about the feasibility of the set of
schedulables currently in the feasibility set.
Implementation Notes
The default feasibility test for the PriorityScheduler
considers a set of schedulables with bounded resource
requirements, to always be feasible. This covers all schedulable
objects with release parameters of types PeriodicParameters
and SporadicParameters
.
When any schedulable 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
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 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
true
, when the system is feasible; false
,
when not.@Deprecated public boolean setIfFeasible(Schedulable schedulable, ReleaseParameters<?> release, MemoryParameters memory)
Schedulable
. When the resulting system is
feasible, this method replaces the current parameters of
Schedulable
with the proposed ones. This method does not require that the schedulable be in the feasibility set before it is called. When it is not initially a member of the feasibility set it will be added when the resulting system is feasible.
setIfFeasible
in class Scheduler
schedulable
- The schedulable for which the changes are
proposed.release
- The proposed release parameters. When
null
, the default value of this scheduler is
used (a new object is created when the default value is not
null
). (See PriorityScheduler
.)memory
- The proposed memory parameters. When
null
, the default value of this scheduler is
used (a new object is created when the default value is not
null
). (See PriorityScheduler
.)true
, when the resulting system is feasible and the changes
are made. False
, when the resulting system is not feasible
and no changes are made.StaticIllegalArgumentException
- when Schedulable
is
null
, or Schedulable
is not
associated with this
scheduler, or the proposed
parameters are not compatible with this
scheduler.IllegalAssignmentError
- when Schedulable
cannot
hold references to the proposed parameter objects, or the
parameter objects cannot hold a reference to
Schedulable
.java.lang.IllegalThreadStateException
- when 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()
.@Deprecated public boolean setIfFeasible(Schedulable schedulable, ReleaseParameters<?> release, MemoryParameters memory, ProcessingGroupParameters group)
Schedulable
. When the resulting system is
feasible, this method replaces the current parameters of
Schedulable
with the proposed ones.
This method does not require that the schedulable be in the feasibility set before it is called. When it is not initially a member of the feasibility set it will be added when the resulting system is feasible.
setIfFeasible
in class Scheduler
schedulable
- The schedulable for which the changes are
proposed.release
- The proposed release parameters. When
null
, the default value of this scheduler is
used (a new object is created when the default value is not
null
). (See PriorityScheduler
.)memory
- The proposed memory parameters. When
null
, the default value of this scheduler is
used (a new object is created when the default value is not
null
). (See PriorityScheduler
.)group
- The proposed processing group parameters. When
null
, the default value of this scheduler is
used (a new object is created when the default value is not
null
). (See PriorityScheduler
.)true
, when the resulting system is feasible and the changes
are made. False
, when the resulting system is not feasible
and no changes are made.StaticIllegalArgumentException
- when Schedulable
is
null
, or Schedulable
is not
associated with this
scheduler, or the proposed
parameters are not compatible with this
scheduler.IllegalAssignmentError
- when Schedulable
cannot
hold references to the proposed parameter objects, or the
parameter objects cannot hold a reference to
Schedulable
.java.lang.IllegalThreadStateException
- when 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()
.@Deprecated public boolean setIfFeasible(Schedulable schedulable, SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory, ProcessingGroupParameters group)
Schedulable
. When the resulting system is
feasible, this method replaces the current parameters of
Schedulable
with the proposed ones.
This method does not require that the schedulable be in the feasibility set before it is called. When it is not initially a member of the feasibility set it will be added when the resulting system is feasible.
setIfFeasible
in class Scheduler
schedulable
- The schedulable for which the changes are
proposed.scheduling
- The proposed scheduling parameters.
When null
, the default value of this scheduler is used
(a new object is created when the default value is not null
).
(See PriorityScheduler
.)release
- The proposed release parameters.
When null
, the default value of this scheduler is used
(a new object is created when the default value is not null
).
(See PriorityScheduler
.)memory
- The proposed memory parameters.
When null
, the default value of this scheduler is used
(a new object is created when the default value is not null
).
(See PriorityScheduler
.)group
- The proposed processing group parameters.
When null
, the default value of this scheduler is used
(a new object is created when the default value is not null
).
(See PriorityScheduler
.)true
, when the resulting system is feasible and the changes
are made. False
, when the resulting system is not feasible
and no changes are made.StaticIllegalArgumentException
- when Schedulable
is
null
, or Schedulable
is not
associated with this
scheduler, or the proposed
parameters are not compatible with this
scheduler.IllegalAssignmentError
- when Schedulable
cannot
hold references to the proposed parameter objects, or the
parameter objects cannot hold a reference to
Schedulable
.java.lang.IllegalThreadStateException
- when 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()
.@Deprecated protected boolean addToFeasibility(Schedulable schedulable)
Schedulable
will be
considered in the feasibility analysis of the associated Scheduler
until further notice. Whether the resulting system is
feasible or not, the addition is completed. When the object is already included in the feasibility set, does nothing.
addToFeasibility
in class Scheduler
schedulable
- A reference to the given instance of Schedulable
true
, when the system is feasible after the addition, otherwise False
.StaticIllegalArgumentException
- when schedulable
is
null
, or when schedulable
is not
associated with this
; that is
schedulable.getScheduler() != this
.@Deprecated protected boolean removeFromFeasibility(Schedulable schedulable)
Schedulable
should no
longer be considered in the feasibility analysis of the associated
Scheduler
. Whether the resulting system is feasible or not,
the removal is completed.removeFromFeasibility
in class Scheduler
schedulable
- A reference to the given instance of Schedulable
true
, when the removal was successful. false
,
when the schedulable cannot be removed from the
scheduler's feasibility set; e.g., the schedulable is not part
of the scheduler's feasibility set.StaticIllegalArgumentException
- when schedulable
is null
.@Deprecated public void fireSchedulable(Schedulable schedulable)
AsyncEventHandler
).fireSchedulable
in class Scheduler
schedulable
- The schedulable to make active.
When null
, nothing happens.StaticUnsupportedOperationException
- Thrown in all cases by
instance of PriorityScheduler
.