javax.realtime
Class PriorityScheduler

java.lang.Object
  extended byjavax.realtime.Scheduler
      extended byjavax.realtime.PriorityScheduler

public class PriorityScheduler
extends Scheduler

This class implements a priority scheduler.

Author:
Angelo Corsaro, Morgan Deters

Field Summary
static int MAX_PRIORITY
          Deprecated. Use getMaxPriority() instead.
static int MIN_PRIORITY
          Deprecated. Use getMinPriority() instead.
 
Constructor Summary
protected PriorityScheduler()
           
 
Method Summary
protected  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.
 int computeExecutionEligibility(Schedulable schedulable)
          Computes the exectuion eligibility that is currently associated to a schedulable object.
 void fireSchedulable(Schedulable schedulable)
          Trigger the execution of a schedulable object (like an instance of AsyncEventHandler).
 ReleaseParameters getDefaultReleaseParameters()
          Get the default ReleaseParameters (in case null is passed in place of ReleaseParameters to a Schedulable).
 SchedulingParameters getDefaultSchedulingParameters()
          Get the default SchedulingParameters (in case null is passed in place of SchedulingParameters to a Schedulable).
 int getMaxPriority()
          Get the maximum priority available for a thread managed by this scheduler.
 int getMaxPriority(Thread thread)
          If the given thread is scheduled by the required PriorityScheduler the maximum priority of the PriorityScheduler is returned otherwise Thread.MAX_PRIORITY is returned.
 int getMinPriority()
          Get the minimum priority available for a thread managed by this scheduler.
 int getMinPriority(Thread thread)
          If the given thread is scheduled by the required PriorityScheduler the minimum priority of the PriorityScheduler is returned otherwise Thread.MIN_PRIORITY is returned.
 int getNormPriority()
          Returns the normal priority available for a thread managed by this scheduler.
 int getNormPriority(Thread thread)
          If the given thread is scheduled by the required PriorityScheduler the normal priority of the PriorityScheduler is returned otherwise Thread.NORM_PRIORITY is returned.
 String getPolicyName()
          Used to determine the policy of the Scheduler
static PriorityScheduler instance()
          Get the PriorityScheduler singleton instance.
 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.
 void notifyThreadStart(RealtimeThread thread)
           
protected  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 .
 boolean setIfFeasible(Schedulable schedulable, ReleaseParameters release, MemoryParameters memory)
          Returns true if, after considering the values of the parameters, the task set would still be feasible.
 boolean setIfFeasible(Schedulable schedulable, ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group)
          Returns true if, after considering the values of the parameters, the task set would still be feasible.
 boolean setIfFeasible(Schedulable schedulable, SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group)
          Returns true if, after considering the values of the parameters, the task set would still be feasible.
 boolean validateSchedulingParameters(Schedulable schedulable)
          Makes sure that the thread has the right set of scheduling parameters for this scheduler.
 
Methods inherited from class javax.realtime.Scheduler
getDefaultScheduler, notifyThreadCompletion, setDefaultScheduler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_PRIORITY

public static final int MAX_PRIORITY
Deprecated. Use getMaxPriority() instead.


MIN_PRIORITY

public static final int MIN_PRIORITY
Deprecated. Use getMinPriority() instead.

Constructor Detail

PriorityScheduler

protected PriorityScheduler()
Method Detail

fireSchedulable

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

Specified by:
fireSchedulable in class Scheduler
Parameters:
schedulable - the Schedulable object to make active.

getMaxPriority

public int getMaxPriority()
Get the maximum priority available for a thread managed by this scheduler.

Returns:
an int value representing the maximum priority available.

getMaxPriority

public int getMaxPriority(Thread thread)
If the given thread is scheduled by the required PriorityScheduler the maximum priority of the PriorityScheduler is returned otherwise Thread.MAX_PRIORITY is returned.

Parameters:
thread - An instance of Thread. If null the maximum priority of the required PriorityScheduler is returned.
Returns:
paraman int value representing the maximum priority.

getMinPriority

public int getMinPriority()
Get the minimum priority available for a thread managed by this scheduler.

Returns:
an int value representing the minumum priority level available.

getMinPriority

public int getMinPriority(Thread thread)
If the given thread is scheduled by the required PriorityScheduler the minimum priority of the PriorityScheduler is returned otherwise Thread.MIN_PRIORITY is returned.

Parameters:
thread - An instance of Thread. If null the minimum priority of the required PriorityScheduler is returned.
Returns:
an int value representing the minimum priority.

getNormPriority

public int getNormPriority()
Returns the normal priority available for a thread managed by this scheduler.

Returns:
an int value representing the normal priority.

getNormPriority

public int getNormPriority(Thread thread)
If the given thread is scheduled by the required PriorityScheduler the normal priority of the PriorityScheduler is returned otherwise Thread.NORM_PRIORITY is returned.

Parameters:
thread - An instance of Thread. If null the normal priority of the required PriorityScheduler is returned.
Returns:
an int value representing the normal priority.

getPolicyName

public String getPolicyName()
Used to determine the policy of the Scheduler

Specified by:
getPolicyName in class Scheduler
Returns:
a String object which is the name of the scheduling policy used by this

instance

public static PriorityScheduler instance()
Get the PriorityScheduler singleton instance.

Returns:
returns a reference to the PriorityScheduler singleton.

isFeasible

public 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.

Specified by:
isFeasible in class Scheduler
Returns:
true if the system is feasible; false otherwise

addToFeasibility

protected 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.

Specified by:
addToFeasibility in class Scheduler
Parameters:
schedulable - the Schedulable entity that has to be considered hereon in the feasibility analysis.
Returns:
true if the system is feasible, false otherwise

removeFromFeasibility

protected 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 subtrac-tion is completed.

Specified by:
removeFromFeasibility in class Scheduler
Parameters:
schedulable - the Schedulable entity that has to be removed from the set of task considered for schedulability analysis.
Returns:
true If the resulting system is feasible.

setIfFeasible

public boolean setIfFeasible(Schedulable schedulable,
                             ReleaseParameters release,
                             MemoryParameters memory)
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.

Specified by:
setIfFeasible in class Scheduler
Parameters:
schedulable - a Schedulable value
release - a ReleaseParameters value
memory - a MemoryParameters value
Returns:
a boolean value

setIfFeasible

public boolean setIfFeasible(Schedulable schedulable,
                             ReleaseParameters release,
                             MemoryParameters memory,
                             ProcessingGroupParameters group)
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.

Specified by:
setIfFeasible in class Scheduler
Parameters:
schedulable - a Schedulable value
release - a ReleaseParameters value
memory - a MemoryParameters value
group - a ProcessingGroupParameters value
Returns:
true if the resulting system is feasible, false otherwise

setIfFeasible

public boolean setIfFeasible(Schedulable schedulable,
                             SchedulingParameters scheduling,
                             ReleaseParameters release,
                             MemoryParameters memory,
                             ProcessingGroupParameters group)
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.

Specified by:
setIfFeasible in class Scheduler
Parameters:
schedulable - a Schedulable value
scheduling - a SchedulingParameters value
release - a ReleaseParameters value
memory - a MemoryParameters value
group - a ProcessingGroupParameters value
Returns:
true if the resulting system is feasible, false otherwise

validateSchedulingParameters

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

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

notifyThreadStart

public void notifyThreadStart(RealtimeThread thread)
Overrides:
notifyThreadStart in class Scheduler

computeExecutionEligibility

public int computeExecutionEligibility(Schedulable schedulable)
Description copied from class: Scheduler
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.

Specified by:
computeExecutionEligibility in class Scheduler
Parameters:
schedulable - a Schedulable for which the execution eligibility has to be computed.
Returns:
an int value representing the eligibility.

getDefaultReleaseParameters

public ReleaseParameters getDefaultReleaseParameters()
Get the default ReleaseParameters (in case null is passed in place of ReleaseParameters to a Schedulable).

Specified by:
getDefaultReleaseParameters in class Scheduler
Returns:
the default ReleaseParameters for this Scheduler.

getDefaultSchedulingParameters

public SchedulingParameters getDefaultSchedulingParameters()
Get the default SchedulingParameters (in case null is passed in place of SchedulingParameters to a Schedulable).

Specified by:
getDefaultSchedulingParameters in class Scheduler
Returns:
the default SchedulingParameters for this Scheduler.


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