public abstract class Scheduler extends Object
Instances of concrete subclasses of this class manage the execution of schedulable objects according to a given scheduling policy.
Additionally, subclasses may implement an algorithm to perform feasibility analysis on the set of schedulable objects is feasible under the implemented scheduling policy.
Concrete subclasses should typically be singletons, i.e., they should provide a method instance() to obtain the instance of the scheduler.
Modifier | Constructor and Description |
---|---|
protected |
Scheduler()
Constructor to be called by sub-classes of this to initialize the
Scheduler.
|
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
addToFeasibility(Schedulable schedulable)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
protected SchedulingParameters |
createDefaultSchedulingParameters()
Create a default
SchedulingParameters instance for this
scheduler. |
static Schedulable |
currentSchedulable()
Gets the current execution context when called from a
Schedulable
execution context. |
abstract void |
fireSchedulable(Schedulable schedulable)
Deprecated.
since RTSJ 2.0
|
static Scheduler |
getDefaultScheduler()
getDefaultScheduler returns a reference to the default scheduler,
which is an instance of PriorityScheduler.
|
abstract String |
getPolicyName()
getPolicyName returns the name of this scheduling policy.
|
static boolean |
inSchedulableExecutionContext()
Determines whether the current calling context is a
Schedulable :
RealtimeThread or AsyncBaseEventHandler . |
abstract boolean |
isFeasible()
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
protected abstract boolean |
removeFromFeasibility(Schedulable schedulable)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
abstract void |
reschedule(Thread thread,
SchedulingParameters eligibility)
Promotes a
java.lang.Thread to realtime priority under this
scheduler. |
static void |
setDefaultScheduler(Scheduler scheduler)
setDefaultScheduler sets the default scheduler to the given
scheduler.
|
abstract boolean |
setIfFeasible(Schedulable schedulable,
ReleaseParameters<?> release,
MemoryParameters memory)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
abstract boolean |
setIfFeasible(Schedulable schedulable,
ReleaseParameters<?> release,
MemoryParameters memory,
ProcessingGroupParameters group)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
abstract boolean |
setIfFeasible(Schedulable schedulable,
SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory,
ProcessingGroupParameters group)
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
protected Scheduler()
public abstract void reschedule(Thread thread, SchedulingParameters eligibility)
java.lang.Thread
to realtime priority under this
scheduler. The affected thread will be scheduled as if it was a
RealtimeThread
with the given eligibility. This does not make
the affected thread a RealtimeThread
, however, and it will
not have access to facilities reserved for instances of
RealtimeThread
. Instances of RealtimeThread
will
be treated as if their scheduling parameters were set to
eligibility
.StaticIllegalArgumentException
- when eligibility
is not valid for the scheduler.StaticIllegalStateException
- when eligibility
specifies parameters that are out of range for the
scheduler or the threads state or the intersection of affinity
in scheduling
and the affinity of realtime thread group
associated with thread
is empty.StaticUnsupportedOperationException
- when thread
a
normal Java thread and the scheduler does not support
promoting normal java threads.thread
- The thread to promote to realtime scheduling.eligibility
- A SchedulingParameters
instance such as
PriorityParameters
for a PriorityScheduler
.@Deprecated protected abstract boolean addToFeasibility(Schedulable schedulable)
StaticIllegalArgumentException
- if schedulable is null or
schedulable is neither RealtimeThread nor AsyncBaseEventHandler.schedulable
- A schedulable object, must not be null.@Deprecated protected abstract boolean removeFromFeasibility(Schedulable schedulable)
StaticIllegalArgumentException
- if schedulable is null or
schedulable is neither RealtimeThread nor AsyncBaseEventHandler.schedulable
- A schedulable object, must not be null.@Deprecated public abstract boolean setIfFeasible(Schedulable schedulable, ReleaseParameters<?> release, MemoryParameters memory)
StaticIllegalArgumentException
- if schedulable is null, release
is null, or the parameter values are not compatible with the
scheduler associated to schedulable.IllegalAssignmentError
- if release or memory and
schedulable reside in memory areas whose objects cannot refer to
one another (in both directions).IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.schedulable
- A schedulable object whose parameters should
be changed.release
- the new release parameters. If null, the default
value for the associated scheduler will be used.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used. The default
value for PriorityScheduler is null.@Deprecated public abstract boolean setIfFeasible(Schedulable schedulable, ReleaseParameters<?> release, MemoryParameters memory, ProcessingGroupParameters group)
StaticIllegalArgumentException
- if schedulable is null, release
is null, or the parameter values are not compatible with the
scheduler associated to schedulable.IllegalAssignmentError
- if release, memory or group and
schedulable reside in memory areas whose objects cannot refer to
one another (in both directions).IllegalThreadStateException
- If the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.schedulable
- A schedulable object whose parameters should
be changed. Must not be null.release
- the new release parameters. Must not be null.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used. The default
value for PriorityScheduler is null.group
- the new processing group parameters. If null, the
default value for the associated scheduler will be used. The
default value for PriorityScheduler is null.@Deprecated public abstract boolean setIfFeasible(Schedulable schedulable, SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory, ProcessingGroupParameters group) throws StaticIllegalArgumentException, IllegalAssignmentError, IllegalThreadStateException
StaticIllegalArgumentException
- if schedulable is null, release
is null or the parameter values are not compatible with the
scheduler associated to schedulable.IllegalAssignmentError
- if the parameters or the
schedulable reside in memory areas whose objects cannot refer to
one another (in both directions).IllegalThreadStateException
- if the old release parameters
are periodic, the new release parameters are not periodic, and the
schedulable object is currently blocked in waitForNextPeriod or
waitForNextPeriodInterruptible.schedulable
- a schedulable object whose parameters should
be changed. Must not be null.scheduling
- the new scheduling parameters.release
- the new release parameters. Must not be null.memory
- the new memory parameters. If null, the default
value for the associated scheduler will be used. The default
value for PriorityScheduler is null.group
- the new processing group parameters. If null, the
default value for the associated scheduler will be used. The
default value for PriorityScheduler is null.public static Scheduler getDefaultScheduler()
public static void setDefaultScheduler(Scheduler scheduler)
scheduler
- the new default scheduler. null to leave the
default scheduler unchanged.public static Schedulable currentSchedulable()
Schedulable
execution context.ClassCastException
- when the caller is not a Schedulable
Schedulable
.public abstract String getPolicyName()
@Deprecated public abstract boolean isFeasible()
@Deprecated public abstract void fireSchedulable(Schedulable schedulable) throws UnsupportedOperationException
UnsupportedOperationException
- is thrown if the scheduler
cannot fire a release of schedulable.schedulable
- a schedulable object.public static boolean inSchedulableExecutionContext()
Schedulable
:
RealtimeThread
or AsyncBaseEventHandler
.true
when yes and false
otherwise.protected SchedulingParameters createDefaultSchedulingParameters()
SchedulingParameters
instance for this
scheduler. 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.IllegalTaskStateException
- when the current task is using
a scheduler that does not support null
scheduling
parameters.aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2025 aicas GmbH. All Rights Reserved.