javax.realtime
Class Scheduler

java.lang.Object
  extended byjavax.realtime.Scheduler
Direct Known Subclasses:
PriorityScheduler

public abstract class Scheduler
extends Object

An instance of Scheduler manages the execution of schedulable objects and may implement a feasibility algorithm. The feasibility algorithm may determine if the known set of schedulable objects, given their particular execution ordering (or priority assignment), is a feasible schedule. 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 public static Scheduler getDefaultScheduler() (e.g., EDFScheduler).

Author:
Angelo Corsaro

Field Summary
protected static Scheduler defaultScheduler
           
 
Constructor Summary
protected Scheduler()
           
 
Method Summary
protected abstract  boolean addToFeasibility(Schedulable schedulable)
          Inform the scheduler and cooperating facilities that the resource demands (as expressed in the associated instances of SchedulingParameters, ReleaseParameters, MemoryParameters ,and ProcessingGroupParameters)of this instance of Schedulable will be considered in the feasibility analysis of the associated Scheduler until further notice.
abstract  int computeExecutionEligibility(Schedulable schedulable)
          Computes the exectuion eligibility that is currently associated to a schedulable object.
abstract  void fireSchedulable(Schedulable schedulable)
          Trigger the execution of a schedulable object (like an AsyncEventHandler).
static Scheduler getDefaultScheduler()
          Get the default scheduler for the system.
abstract  String getPolicyName()
          Get a string representing the scheduling policy implemented by the scheduler.
abstract  boolean isFeasible()
          Returns true if and only if the system is able to satisfy the constraints expressed in the release parameters of the existing schedulable objects.
protected abstract  boolean removeFromFeasibility(Schedulable schedulable)
          Inform the scheduler and cooperating facilities that the resource demands, as expressed in the associated instances of SchedulingParameters, ReleaseParameters, MemoryParameters,and ProcessingGroupParameters , of this instance of Schedulable should no longer be considered in the feasibility analysis of the associated Scheduler .
static void setDefaultScheduler(Scheduler scheduler)
          Set the default scheduler.
 boolean setIfFeasible(Schedulable schedulable, ReleaseParameters releaseParam, MemoryParameters memoryParam)
          Returns true if, after considering the values of the parameters, the task set would still be feasible.
 boolean setIfFeasible(Schedulable schedulable, ReleaseParameters releaseParam, MemoryParameters memoryParam, ProcessingGroupParameters groupParam)
          Returns true if, after considering the values of the parameters, the task set would still be feasible.
abstract  boolean validateSchedulingParameters(Schedulable schedulable)
          Makes sure that the thread has the right set of scheduling parameters for this scheduler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultScheduler

protected static Scheduler defaultScheduler
Constructor Detail

Scheduler

protected Scheduler()
Method Detail

addToFeasibility

protected abstract boolean addToFeasibility(Schedulable schedulable)
Inform the scheduler and cooperating facilities that the resource demands (as expressed in the associated instances of SchedulingParameters, ReleaseParameters, MemoryParameters ,and ProcessingGroupParameters)of this instance of 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.

Parameters:
schedulable - the Schedulable entity to be added to the feasibility set.
Returns:
true If the resulting system is feasible.

fireSchedulable

public abstract void fireSchedulable(Schedulable schedulable)
Trigger the execution of a schedulable object (like an AsyncEventHandler).

Parameters:
schedulable - the schedulable object to make active.

getDefaultScheduler

public static Scheduler getDefaultScheduler()
Get the default scheduler for the system.

Returns:
Return a reference to the default scheduler.

getPolicyName

public abstract String getPolicyName()
Get a string representing the scheduling policy implemented by the scheduler.

Returns:
A String object which is the name of the scheduling policy used by this.

isFeasible

public abstract boolean isFeasible()
Returns true if and only if the system is able to satisfy the constraints expressed in the release parameters of the existing schedulable objects.

Returns:
true or false depending on whether the system is feasible.

removeFromFeasibility

protected abstract boolean removeFromFeasibility(Schedulable schedulable)
Inform the scheduler and cooperating facilities that the resource demands, as expressed in the associated instances of SchedulingParameters, ReleaseParameters, MemoryParameters,and ProcessingGroupParameters , of this instance of Schedulable should no longer be considered in the feasibility analysis of the associated Scheduler . Whether the resulting system is feasible or not, the subtraction is completed.

Parameters:
schedulable - a Schedulable object that has to be removed from the task set that is considered for feasibility analysis.
Returns:
true If the resulting system is feasible.

setDefaultScheduler

public static void setDefaultScheduler(Scheduler scheduler)
Set the default scheduler. This is the scheduler given to instances of RealtimeThread when they are constructed. The default scheduler is set to the required PriorityScheduler at startup.

Parameters:
scheduler - The Scheduler that becomes the default scheduler assigned to new threads. If null nothing happens.

setIfFeasible

public boolean setIfFeasible(Schedulable schedulable,
                             ReleaseParameters releaseParam,
                             MemoryParameters memoryParam)
Returns true if, after considering the values of the parameters, the task set would still be feasible. In this case the values of the parameters are changed. Returns false if, after considering the values of the parameters, the task set would not be feasible. In this case the values of the parameters are not changed.

Parameters:
schedulable - a Schedulable value
releaseParam - a ReleaseParameters value
memoryParam - a MemoryParameters value
Returns:
true if the resulting system is feasible, false otherwise.

setIfFeasible

public boolean setIfFeasible(Schedulable schedulable,
                             ReleaseParameters releaseParam,
                             MemoryParameters memoryParam,
                             ProcessingGroupParameters groupParam)
Returns true if, after considering the values of the parameters, the task set would still be feasible. In this case the values of the parameters are changed. Returns false if, after considering the values of the parameters, the task set would not be feasible. In this case the values of the parameters are not changed.

Parameters:
schedulable - a Schedulable value
releaseParam - a ReleaseParameters value
memoryParam - a MemoryParameters value
groupParam - a ProcessingGroupParameters value
Returns:
true if the resulting system is feasible, false otherwise.

validateSchedulingParameters

public abstract boolean validateSchedulingParameters(Schedulable schedulable)
Makes sure that the thread has the right set of scheduling parameters for this scheduler.

Parameters:
schedulable - a schedulable entity
Returns:
true if the given thread has all the scheduling parameters needed by the given scheduler.

computeExecutionEligibility

public abstract int computeExecutionEligibility(Schedulable schedulable)
Computes the exectuion eligibility that is currently associated to a schedulable object. The execution eligibility provide a total ordering for the schedulable entities present in the system.

Parameters:
schedulable - a Schedulable for which the execution eligibility has to be computed.
Returns:
an int value representing the eligibility.


jRate is developed and maintained by the jRate project development team.
Copyright (c) 2001-2005 Angelo Corsaro and Morgan Deters.