javax.realtime
Class DebugScheduler

java.lang.Object
  |
  +--javax.realtime.Scheduler
        |
        +--javax.realtime.DebugScheduler

public class DebugScheduler
extends Scheduler

DebugScheduler is a scheduler designed to test the rest of the system. It produces a prodigious amount of debugging output as well as asserting many invariants.


Field Summary
(package private)  javax.realtime.RefList disabledThreads
           
(package private) static javax.realtime.DebugScheduler instance
           
(package private)  java.util.Iterator iterator
           
(package private)  javax.realtime.RefList threadList
           
 
Fields inherited from class javax.realtime.Scheduler
defaultScheduler
 
Constructor Summary
protected DebugScheduler()
           
 
Method Summary
protected  void addThread(long threadID)
          Used for adding a C thread that doesn't have any Java counterpart.
protected  void addThread(javax.realtime.RealtimeThread thread)
          Adds a thread to the thread list
protected  void addToFeasibility(javax.realtime.Schedulable schedulable)
          It is always feasible to add another thread to a DebugScheduler.
protected  long chooseThread(long currentTime)
          Chooses a thread to run
protected  void disableThread(long threadID)
          Stop running threadID until enableThread - used in the lock implementation to wait on a lock.
protected  void enableThread(long threadID)
          Enable threadID, allowing it run again - used in notify
 void fireSchedulable(javax.realtime.Schedulable schedulable)
          Trigger the execution of a schedulable object (like an AsyncEventHandler.
 java.lang.String getPolicyName()
          Used to determine the policy of the Scheduler.
static javax.realtime.DebugScheduler instance()
          Return an instance of a DebugScheduler
 boolean isFeasible()
          It is always feasible to add another thread to a DebugScheduler.
protected  boolean isFeasible(javax.realtime.Schedulable s, javax.realtime.ReleaseParameters rp)
          It is always feasible to add another thread to a DebugScheduler.
protected  void removeFromFeasibility(javax.realtime.Schedulable schedulable)
          It is always feasible to add another thread to a DebugScheduler.
protected  void removeThread(long threadID)
          Used for removing a C thread that doesn't have any Java counterpart.
protected  void removeThread(javax.realtime.RealtimeThread thread)
          Removes a thread from the thread list
 boolean setIfFeasible(javax.realtime.Schedulable schedulable, javax.realtime.ReleaseParameters release, javax.realtime.MemoryParameters memory)
          It is always feasible to add another thread to a DebugScheduler.
 boolean setIfFeasible(javax.realtime.Schedulable schedulable, javax.realtime.ReleaseParameters release, javax.realtime.MemoryParameters memory, javax.realtime.ProcessingGroupParameters group)
          It is always feasible to add another thread to a DebugScheduler.
 java.lang.String toString()
           
protected  void waitForNextPeriod(javax.realtime.RealtimeThread rt)
          Cause the thread to block until the next period
 
Methods inherited from class javax.realtime.Scheduler
addThreadToLists, atomic, getDefaultScheduler, jAddCThread, jChooseThread, jDisableThread, jEnableThread, jNumThreads, jRemoveCThread, print, removeThreadFromLists, setDefaultScheduler, setQuanta
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

instance

static javax.realtime.DebugScheduler instance

threadList

javax.realtime.RefList threadList

disabledThreads

javax.realtime.RefList disabledThreads

iterator

java.util.Iterator iterator
Constructor Detail

DebugScheduler

protected DebugScheduler()
Method Detail

instance

public static javax.realtime.DebugScheduler instance()
Return an instance of a DebugScheduler


addToFeasibility

protected void addToFeasibility(javax.realtime.Schedulable schedulable)
It is always feasible to add another thread to a DebugScheduler.

Specified by:
addToFeasibility in class Scheduler
Parameters:
schedulable - A reference to the given instance of Schedulable.
Returns:
True, if the addition was successful. False, if not.

fireSchedulable

public void fireSchedulable(javax.realtime.Schedulable schedulable)
Description copied from class: Scheduler
Trigger the execution of a schedulable object (like an AsyncEventHandler.

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

getPolicyName

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

Specified by:
getPolicyName in class Scheduler
Returns:
A java.lang.String object which is the name of the scheduling polixy used by this.

isFeasible

public boolean isFeasible()
It is always feasible to add another thread to a DebugScheduler.

Specified by:
isFeasible in class Scheduler

isFeasible

protected boolean isFeasible(javax.realtime.Schedulable s,
                             javax.realtime.ReleaseParameters rp)
It is always feasible to add another thread to a DebugScheduler.

Specified by:
isFeasible in class Scheduler

removeFromFeasibility

protected void removeFromFeasibility(javax.realtime.Schedulable schedulable)
It is always feasible to add another thread to a DebugScheduler.

Specified by:
removeFromFeasibility in class Scheduler
Returns:
True, if the removal was successful. False, if the removal was unsuccessful.

setIfFeasible

public boolean setIfFeasible(javax.realtime.Schedulable schedulable,
                             javax.realtime.ReleaseParameters release,
                             javax.realtime.MemoryParameters memory)
It is always feasible to add another thread to a DebugScheduler.

Specified by:
setIfFeasible in class Scheduler
Parameters:
schedulable - The instance of Schedulable to which the parameters will be assigned.
release - The proposed release parameters.
memory - The proposed memory parameters.
Returns:
True, if the resulting system is feasible and the changes are made. False, if the resulting system is not feasible and no changes are made.

setIfFeasible

public boolean setIfFeasible(javax.realtime.Schedulable schedulable,
                             javax.realtime.ReleaseParameters release,
                             javax.realtime.MemoryParameters memory,
                             javax.realtime.ProcessingGroupParameters group)
It is always feasible to add another thread to a DebugScheduler.

Specified by:
setIfFeasible in class Scheduler
Parameters:
schedulable - The instance of Schedulable to which the parameters will be assigned.
release - The proposed release parameters.
memory - The proposed memory parameters.
group - The proposed processing group parameters.
Returns:
True, if the resulting system is feasible and the changes are made. False, if the resulting system is not feasible and no changes are made.

chooseThread

protected long chooseThread(long currentTime)
Description copied from class: Scheduler
Chooses a thread to run

Specified by:
chooseThread in class Scheduler

addThread

protected void addThread(javax.realtime.RealtimeThread thread)
Description copied from class: Scheduler
Adds a thread to the thread list

Specified by:
addThread in class Scheduler

removeThread

protected void removeThread(javax.realtime.RealtimeThread thread)
Description copied from class: Scheduler
Removes a thread from the thread list

Specified by:
removeThread in class Scheduler

addThread

protected void addThread(long threadID)
Description copied from class: Scheduler
Used for adding a C thread that doesn't have any Java counterpart. The convention is that the threadID for C threads is negative.

Specified by:
addThread in class Scheduler

removeThread

protected void removeThread(long threadID)
Description copied from class: Scheduler
Used for removing a C thread that doesn't have any Java counterpart. The convention is that the threadID for C threads is negative.

Specified by:
removeThread in class Scheduler

disableThread

protected void disableThread(long threadID)
Description copied from class: Scheduler
Stop running threadID until enableThread - used in the lock implementation to wait on a lock.

Specified by:
disableThread in class Scheduler

enableThread

protected void enableThread(long threadID)
Description copied from class: Scheduler
Enable threadID, allowing it run again - used in notify

Specified by:
enableThread in class Scheduler

waitForNextPeriod

protected void waitForNextPeriod(javax.realtime.RealtimeThread rt)
Description copied from class: Scheduler
Cause the thread to block until the next period

Specified by:
waitForNextPeriod in class Scheduler

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object