java.lang.Object javax.realtime.Scheduler
An instance of Scheduler
manages
the execution of schedulable objects and implements a feasibility
algorithm. The feasibility algorithm determines if the
known set of schedulable objects, given their
particular execution ordering (or priority assignment), is a feasible system.
Subclasses of Scheduler
are used for alternative scheduling policies
and should define an instance()
class method to return the
default instance of the subclass. The name of the subclass should be descriptive
of the policy, allowing applications to deduce the policy available for the scheduler
obtained via getDefaultScheduler()
(e.g., EDFScheduler
).
Constructor Summary | |
protected |
Scheduler()
Create an instance of Scheduler . |
Method Summary | |
protected abstract 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. |
abstract void |
fireSchedulable(Schedulable schedulable)
Trigger the execution of a schedulable object (like an AsyncEventHandler ). |
static Scheduler |
getDefaultScheduler()
Gets a reference to the default scheduler. |
abstract java.lang.String |
getPolicyName()
Gets a string representing the policy of this .
|
abstract boolean |
isFeasible()
Queries the system about the feasibility of the system currently being considered. |
protected abstract 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 . |
static void |
setDefaultScheduler(Scheduler scheduler)
Sets the default scheduler. |
abstract 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. |
abstract 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. |
abstract boolean |
setIfFeasible(Schedulable schedulable,
SchedulingParameters scheduling,
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Scheduler()
Scheduler
.
Method Detail |
public static Scheduler getDefaultScheduler()
public static void setDefaultScheduler(Scheduler scheduler)
PriorityScheduler
at startup.
scheduler
- The Scheduler
that becomes the default scheduler
assigned to new schedulable objects created by
Java threads. If null nothing happens.
java.lang.SecurityException
- Thrown if the caller is not permitted to set the default scheduler.protected abstract 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.
If the object is already included in the feasibility set, do nothing.
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
.public abstract void fireSchedulable(Schedulable schedulable)
AsyncEventHandler
).
schedulable
- The schedulable object to make active.
If null, nothing happens.
java.lang.UnsupportedOperationException
- Thrown if the scheduler cannot release
schedulable
for execution.public abstract java.lang.String getPolicyName()
this
.
The string value need not be interned, but it must be created in
a memory area that is compatible
with the caller's execution environment.
String
object which is the name of the scheduling policy used by this
.public abstract boolean isFeasible()
protected abstract 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.
schedulable
- A reference to the given instance of Schedulable
java.lang.IllegalArgumentException
- Thrown if schedulable
is null.public abstract 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.
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 abstract 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.
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 abstract boolean setIfFeasible(Schedulable schedulable, SchedulingParameters scheduling, 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.
schedulable
- The schedulable object for which the changes are proposed.scheduling
- 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()
.