javax.realtime
Class RealtimeThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--javax.realtime.RealtimeThread
All Implemented Interfaces:
java.lang.Runnable, Schedulable
Direct Known Subclasses:
NoHeapRealtimeThread, QuantaThread

public class RealtimeThread
extends java.lang.Thread
implements Schedulable

Class RealtimeThread extends java.lang.Thread and includes classes and methods to get and set parameterer objects, manage the execution of those threads with a ReleaseParameters type of PeriodicParameters, and manage waiting.

A RealtimeThread object must be placed in a memory area such that thread logic may unexceptionally access instance variables and such that Java methods on java.lang.Thread (e.g., enumerate and join) complete normally except where such execution would cause access violations.

Parameters for constructors may be null. In such cases the default value will be the default value set for the particular type by the associated instance of Scheduler.


Field Summary
private  boolean blocked
           
(package private)  long checkDepth
           
 javax.realtime.Scheduler currentScheduler
           
(package private)  int heapMemCount
          The top of the stack for this RealtimeThread.
(package private)  javax.realtime.MemoryArea mem
          Contains the memoryArea associated with this mem.
(package private)  javax.realtime.MemAreaStack memAreaStack
          Contains the cactus stack of previous memoryAreas...
(package private)  javax.realtime.MemoryParameters memoryParameters
           
private static long nextThreadID
           
(package private)  boolean noHeap
          Specifies whether this RealtimeThread has access to the heap.
(package private)  javax.realtime.MemoryArea original
          Contains the memoryArea associated with this mem.
(package private)  javax.realtime.ProcessingGroupParameters processingGroupParameters
           
(package private)  javax.realtime.ReleaseParameters releaseParameters
          Realtime parameters for this thread
(package private) static boolean RTJ_init_in_progress
          Specifies whether the initialization code has finished setting up RTJ.
(package private)  javax.realtime.SchedulingParameters schedulingParameters
           
private  java.lang.Runnable target
          The target to run.
private  long threadID
           
(package private)  javax.realtime.MemAreaStack topStack
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RealtimeThread()
          Create a real-time thread.
RealtimeThread(javax.realtime.MemoryArea memory)
           
RealtimeThread(javax.realtime.MemoryArea memory, java.lang.Runnable target)
           
RealtimeThread(javax.realtime.MemoryParameters mp, java.lang.Runnable target)
           
RealtimeThread(java.lang.Runnable target)
           
RealtimeThread(java.lang.Runnable target, java.lang.String name)
           
RealtimeThread(javax.realtime.SchedulingParameters scheduling)
          Create a real-time thread with the given SchedulingParameters.
RealtimeThread(javax.realtime.SchedulingParameters scheduling, javax.realtime.ReleaseParameters release)
          Create a real-time thread with the given SchedulingParameters and ReleaseParameters.
RealtimeThread(javax.realtime.SchedulingParameters scheduling, javax.realtime.ReleaseParameters release, javax.realtime.MemoryParameters memory, javax.realtime.MemoryArea area, javax.realtime.ProcessingGroupParameters group, java.lang.Runnable logic)
          Create a real-time thread with the given characteristics and a java.lang.Runnable.
RealtimeThread(java.lang.String name)
           
RealtimeThread(java.lang.ThreadGroup group, java.lang.Runnable target)
           
RealtimeThread(java.lang.ThreadGroup group, java.lang.Runnable target, java.lang.String name)
           
RealtimeThread(java.lang.ThreadGroup group, java.lang.Runnable target, java.lang.String name, javax.realtime.MemoryArea memory)
           
RealtimeThread(java.lang.ThreadGroup group, java.lang.String name)
           
 
Method Summary
static int activeCount()
           
 boolean addIfFeasible()
          Add the scheduling and release characteristics of this to the sed of such characteristics already being considered, if the addition would result in the new, larger set being feasible.
 boolean addToFeasibility()
          Inform the scheduler and cooperating facilities that scheduling and release characteristics of this instance of Schedulable should be considered in feasibility analysis until further notified.
 void bindSchedulable()
          Informs ReleaseParameters, ProcessingGroupParameters and MemoryParameters that this has them as its parameters.
(package private)  boolean checkAccess(javax.realtime.MemoryArea source, javax.realtime.MemoryArea target)
           
(package private) static void checkInit()
           
 void checkNoHeapRead(java.lang.Object obj)
           
 void checkNoHeapWrite(java.lang.Object obj)
           
(package private)  void cleanup()
           
static javax.realtime.RealtimeThread currentRealtimeThread()
          Gets a reference to the current instance of RealtimeThread.
static java.lang.Thread currentThread()
          Returns the current running thread.
 void deschedulePeriodic()
          Stop unblocking waitForNextPeriod() for this if the type of the associated instance of ReleaseParameters is PeriodicParameters.
static void dumpStack()
           
(package private)  void enter(javax.realtime.MemoryArea mem, javax.realtime.MemoryArea original)
           
static int enumerate(java.lang.Thread[] tarray)
          Same as java.lang.Thread.enumerate().
(package private)  void exitMem()
           
 javax.realtime.MemoryArea getCurrentMemoryArea()
          Gets the current memory area of this.
 int getInitialMemoryAreaIndex()
          Memory area stacks include inherited stacks from parent threads.
 javax.realtime.MemoryArea getMemoryArea()
          Gets a reference to the current MemoryArea.
 int getMemoryAreaStackDepth()
          Get the size of the stack of MemoryArea instances to which this RealtimeThread has access.
 javax.realtime.MemoryParameters getMemoryParameters()
          Gets a reference to the MemoryParameters object.
 javax.realtime.MemoryArea getOuterMemoryArea(int index)
          Gets the instance of MemoryArea in the memory area stack at the index given.
 javax.realtime.ProcessingGroupParameters getProcessingGroupParameters()
          Gets a reference to the ProcessingGroupParameters object.
 javax.realtime.ReleaseParameters getReleaseParameters()
          Gets a reference to the ReleaseParameters object.
 javax.realtime.Scheduler getScheduler()
          Get a reference to the Scheduler object.
 javax.realtime.SchedulingParameters getSchedulingParameters()
          Gets a reference to the SchedulingParameters object.
 long getUID()
          Return a UID for this Schedulable object.
(package private)  void initScheduler()
           
 void interrupt()
          Sets the state of the generic AsynchronouslyInterruptedException to pending.
static boolean interrupted()
          Same as java.lang.Thread.interrupted().
 javax.realtime.MemoryArea memoryArea()
          For internal use only.
(package private)  javax.realtime.MemoryArea outerScope(javax.realtime.MemoryArea child)
          Get the outerScope of a given MemoryArea for the current RealtimeThread.
 void removeFromFeasibility()
          Inform the scheduler and cooperating facilities that the scheduling and release characteristics of this instance of Schedulable should not be considered in feasibility analyses until further notified.
 void run()
          Override the Thread.run() method, because Thread.run() doesn't work.
(package private)  void schedule()
          Schedule this on the thread lists
 void schedulePeriodic()
          Begin unblocking waitForNextPeriod() for a periodic thread.
 boolean setIfFeasible(javax.realtime.ReleaseParameters release, javax.realtime.MemoryParameters memory)
          This method appears in many classes in the RTSJ and with various parameters.
 boolean setIfFeasible(javax.realtime.ReleaseParameters release, javax.realtime.MemoryParameters memory, javax.realtime.ProcessingGroupParameters group)
          This method appears in many classes in the RTSJ and with various parameters.
 boolean setIfFeasible(javax.realtime.ReleaseParameters release, javax.realtime.ProcessingGroupParameters group)
          This method appears in many classes in the RTSJ and with various parameters.
 void setMemoryParameters(javax.realtime.MemoryParameters memory)
          Sets the memory parameters associated with this instance of Schedulable.
 boolean setMemoryParametersIfFeasible(javax.realtime.MemoryParameters memParam)
          The method first performs a feasibility analysis using the ginve memory parameters as replacements for the memory parameters of this.
 void setProcessingGroupParameters(javax.realtime.ProcessingGroupParameters parameters)
          Sets the reference to the ProcessingGroupParameters object.
 boolean setProcessingGroupParametersIfFeasible(javax.realtime.ProcessingGroupParameters groupParameters)
          Sets the ProcessingGroupParameters of this only if the resulting set of scheduling and release characteristics is feasible.
 void setReleaseParameters(javax.realtime.ReleaseParameters release)
          Since this affects the constraints expressed in the release parameters of the existing schedulable objects, this may change the feasibility of the current schedule.
 boolean setReleaseParametersIfFeasible(javax.realtime.ReleaseParameters release)
          Set the ReleaseParameters for this schedulable object only if the resulting set of scheduling and release characteristics is feasible.
 void setScheduler(javax.realtime.Scheduler scheduler)
          Sets the reference to the Scheduler object.
 void setScheduler(javax.realtime.Scheduler scheduler, javax.realtime.SchedulingParameters scheduling, javax.realtime.ReleaseParameters release, javax.realtime.MemoryParameters memParameters, javax.realtime.ProcessingGroupParameters processingGroup)
          Sets the scheduler and associated parameter objects.
 void setSchedulingParameters(javax.realtime.SchedulingParameters scheduling)
          Sets the reference to the SchedulingParameters object.
 boolean setSchedulingParametersIfFeasible(javax.realtime.SchedulingParameters scheduling)
          The method first performs a feasiblity analysis using the given scheduling parameters as replacements for the scheduling parameters of this.
private  void setup()
          This sets up the unspecified local variables for the constructor.
static void sleep(javax.realtime.Clock clock, javax.realtime.HighResolutionTime time)
          An accurate timer with nanoseconds granularity.
static void sleep(javax.realtime.HighResolutionTime time)
          An accurate timer with nanoseconds granularity.
static void sleep(long millis)
          Same as java.lang.Thread.sleep(long).
static void sleep(long millis, int nanos)
          Same as java.lang.Thread.sleep(long, int).
 void start()
          Starts the thread.
 java.lang.String toString()
           
 void unbindSchedulable()
          Informs ReleaseParameters, ProcessingGroupParameters and MemoryParameters that this does not have them any longer as its parameters.
(package private)  void unschedule()
          Deschedule this from the thread lists
 boolean waitForNextPeriod()
          Used by threads that have a reference to a ReleaseParameters type of PeriodicParameters to block until the start of each period.
static void yield()
          Same as java.lang.Thread.yield().
 
Methods inherited from class java.lang.Thread
checkAccess, countStackFrames, destroy, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, stop, stop, suspend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

currentScheduler

public javax.realtime.Scheduler currentScheduler

memAreaStack

javax.realtime.MemAreaStack memAreaStack
Contains the cactus stack of previous memoryAreas...


heapMemCount

int heapMemCount
The top of the stack for this RealtimeThread.


topStack

javax.realtime.MemAreaStack topStack

noHeap

boolean noHeap
Specifies whether this RealtimeThread has access to the heap.


blocked

private boolean blocked

mem

javax.realtime.MemoryArea mem
Contains the memoryArea associated with this mem.


original

javax.realtime.MemoryArea original
Contains the memoryArea associated with this mem.


releaseParameters

javax.realtime.ReleaseParameters releaseParameters
Realtime parameters for this thread


memoryParameters

javax.realtime.MemoryParameters memoryParameters

schedulingParameters

javax.realtime.SchedulingParameters schedulingParameters

processingGroupParameters

javax.realtime.ProcessingGroupParameters processingGroupParameters

RTJ_init_in_progress

static boolean RTJ_init_in_progress
Specifies whether the initialization code has finished setting up RTJ.


target

private java.lang.Runnable target
The target to run.


nextThreadID

private static long nextThreadID

threadID

private long threadID

checkDepth

long checkDepth
Constructor Detail

RealtimeThread

public RealtimeThread()
Create a real-time thread. All parameter values are null.


RealtimeThread

public RealtimeThread(javax.realtime.SchedulingParameters scheduling)
Create a real-time thread with the given SchedulingParameters.

Parameters:
scheduling - The SchedulingParameters associated with this (and possibly other instances of Schedulable).

RealtimeThread

public RealtimeThread(javax.realtime.SchedulingParameters scheduling,
                      javax.realtime.ReleaseParameters release)
Create a real-time thread with the given SchedulingParameters and ReleaseParameters.

Parameters:
scheduling - The SchedulingParameters associated with this (and possibly other instances of Schedulable).
release - The ReleaseParameters associated with this (and possibly other instances of Schedulable).

RealtimeThread

public RealtimeThread(javax.realtime.SchedulingParameters scheduling,
                      javax.realtime.ReleaseParameters release,
                      javax.realtime.MemoryParameters memory,
                      javax.realtime.MemoryArea area,
                      javax.realtime.ProcessingGroupParameters group,
                      java.lang.Runnable logic)
Create a real-time thread with the given characteristics and a java.lang.Runnable.

Parameters:
scheduling - The SchedulingParameters associated with this (and possibly other instances of Schedulable).
release - The ReleaseParameters associated with this (and possibly other instances of Schedulable).
memory - The MemoryParameters associated with this (and possibly other instances of Schedulable).
area - The MemoryArea associated with this.
group - The ProcessingGroupParameters associated with this (and possibly other instances of Schedulable).
logic - A Runnable whose run() method will be executed for this.

RealtimeThread

public RealtimeThread(java.lang.ThreadGroup group,
                      java.lang.Runnable target)

RealtimeThread

public RealtimeThread(javax.realtime.MemoryArea memory)

RealtimeThread

public RealtimeThread(javax.realtime.MemoryParameters mp,
                      java.lang.Runnable target)

RealtimeThread

public RealtimeThread(java.lang.Runnable target)

RealtimeThread

public RealtimeThread(java.lang.String name)

RealtimeThread

public RealtimeThread(java.lang.ThreadGroup group,
                      java.lang.Runnable target,
                      java.lang.String name)

RealtimeThread

public RealtimeThread(java.lang.ThreadGroup group,
                      java.lang.String name)

RealtimeThread

public RealtimeThread(java.lang.Runnable target,
                      java.lang.String name)

RealtimeThread

public RealtimeThread(javax.realtime.MemoryArea memory,
                      java.lang.Runnable target)

RealtimeThread

public RealtimeThread(java.lang.ThreadGroup group,
                      java.lang.Runnable target,
                      java.lang.String name,
                      javax.realtime.MemoryArea memory)
Method Detail

getUID

public long getUID()
Description copied from interface: Schedulable
Return a UID for this Schedulable object.

Specified by:
getUID in interface Schedulable

checkInit

static void checkInit()

setup

private void setup()
This sets up the unspecified local variables for the constructor.


initScheduler

void initScheduler()

addIfFeasible

public boolean addIfFeasible()
Add the scheduling and release characteristics of this to the sed of such characteristics already being considered, if the addition would result in the new, larger set being feasible.

Specified by:
addIfFeasible in interface Schedulable
Returns:
True, if the addition would result in the set of considered characteristics being feasible. False, if the addition would result in the set of considered characteristics being infeasible or there is no assigned instance of Scheduler.

addToFeasibility

public boolean addToFeasibility()
Inform the scheduler and cooperating facilities that scheduling and release characteristics of this instance of Schedulable should be considered in feasibility analysis until further notified.

Specified by:
addToFeasibility in interface Schedulable
Returns:
True, if the addition was successful. False, if not.

currentRealtimeThread

public static javax.realtime.RealtimeThread currentRealtimeThread()
                                                           throws java.lang.ClassCastException
Gets a reference to the current instance of RealtimeThread.

Returns:
A reference to the current instance of RealtimeThread.
Throws:
java.lang.ClassCastException - If the current thread is not a RealtimeThread.

deschedulePeriodic

public void deschedulePeriodic()
Stop unblocking waitForNextPeriod() for this if the type of the associated instance of ReleaseParameters is PeriodicParameters. If this does not have a type of PeriodicParameters, nothing happens.


getCurrentMemoryArea

public javax.realtime.MemoryArea getCurrentMemoryArea()
Gets the current memory area of this.

Returns:
A reference to the current MemoryArea object.

getInitialMemoryAreaIndex

public int getInitialMemoryAreaIndex()
Memory area stacks include inherited stacks from parent threads. The initial memory area for the current RealtimeThread is the memory area given as a parameter to the constructor. This method returns the position in the memory area stack of that initial memory area.

Returns:
The index into the memory area stack of the initial memory area of the current RealtimeThread.

getMemoryArea

public javax.realtime.MemoryArea getMemoryArea()
Gets a reference to the current MemoryArea.

Returns:
A reference to the current memory area in which allocations occur.

getMemoryAreaStackDepth

public int getMemoryAreaStackDepth()
Get the size of the stack of MemoryArea instances to which this RealtimeThread has access.

Returns:
The size of the stack of MemoryArea instances.

getMemoryParameters

public javax.realtime.MemoryParameters getMemoryParameters()
Gets a reference to the MemoryParameters object.

Specified by:
getMemoryParameters in interface Schedulable
Returns:
A reference to the current MemoryParameters object.

getOuterMemoryArea

public javax.realtime.MemoryArea getOuterMemoryArea(int index)
Gets the instance of MemoryArea in the memory area stack at the index given. If the given index does not exist in the memory area scope stack then null is returned.

Parameters:
index - The offset into the memory area stack.
Returns:
The instance of MemoryArea at index or null if the given value does not correspond to a position in the stack.

getProcessingGroupParameters

public javax.realtime.ProcessingGroupParameters getProcessingGroupParameters()
Gets a reference to the ProcessingGroupParameters object.

Specified by:
getProcessingGroupParameters in interface Schedulable
Returns:
A reference to the current ProcessingGroupParameters object.

getReleaseParameters

public javax.realtime.ReleaseParameters getReleaseParameters()
Gets a reference to the ReleaseParameters object.

Specified by:
getReleaseParameters in interface Schedulable
Returns:
A reference to the current ReleaseParameters object.

getScheduler

public javax.realtime.Scheduler getScheduler()
Get a reference to the Scheduler object.

Specified by:
getScheduler in interface Schedulable
Returns:
A reference to the current Scheduler object.

getSchedulingParameters

public javax.realtime.SchedulingParameters getSchedulingParameters()
Gets a reference to the SchedulingParameters object.

Specified by:
getSchedulingParameters in interface Schedulable
Returns:
A reference to the current SchedulingParameters object.

interrupt

public void interrupt()
Sets the state of the generic AsynchronouslyInterruptedException to pending.

Overrides:
interrupt in class java.lang.Thread

removeFromFeasibility

public void removeFromFeasibility()
Inform the scheduler and cooperating facilities that the scheduling and release characteristics of this instance of Schedulable should not be considered in feasibility analyses until further notified.

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

schedulePeriodic

public void schedulePeriodic()
Begin unblocking waitForNextPeriod() for a periodic thread. Typically used when a periodic schedulable object is in an overrun condition. The scheduler should recompute the schedule and perform admission control. If this does not have a type of PeriodicParameters as its ReleaseParameters, nothing happens.


setIfFeasible

public boolean setIfFeasible(javax.realtime.ReleaseParameters release,
                             javax.realtime.MemoryParameters memory)
This method appears in many classes in the RTSJ and with various parameters. The parameters are either new scheduling characteristics for an instance Schedulable or an instance of Schedulable. The method first performs a feasibility analysis using the new scheduling characteristics as replacements for the matching scheduling characteristics of either this or the given instance of Schedulable. If the resulting system is feasible the method replaces the current scheduling characteristics, of either this or the given instance of Schedulable as appropriate, with the new scheduling characteristics.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
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.ReleaseParameters release,
                             javax.realtime.MemoryParameters memory,
                             javax.realtime.ProcessingGroupParameters group)
This method appears in many classes in the RTSJ and with various parameters. The parameters are either new scheduling characteristics for an instance Schedulable or an instance of Schedulable. The method first performs a feasibility analysis using the new scheduling characteristics as replacements for the matching scheduling characteristics of either this or the given instance of Schedulable. If the resulting system is feasible the method replaces the current scheduling characteristics, of either this or the given instance of Schedulable as appropriate, with the new scheduling characteristics.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
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.

setIfFeasible

public boolean setIfFeasible(javax.realtime.ReleaseParameters release,
                             javax.realtime.ProcessingGroupParameters group)
This method appears in many classes in the RTSJ and with various parameters. The parameters are either new scheduling characteristics for an instance Schedulable or an instance of Schedulable. The method first performs a feasibility analysis using the new scheduling characteristics as replacements for the matching scheduling characteristics of either this or the given instance of Schedulable. If the resulting system is feasible the method replaces the current scheduling characteristics, of either this or the given instance of Schedulable as appropriate, with the new scheduling characteristics.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
release - The proposed release 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.

setMemoryParameters

public void setMemoryParameters(javax.realtime.MemoryParameters memory)
                         throws java.lang.IllegalThreadStateException
Sets the memory parameters associated with this instance of Schedulable.

Specified by:
setMemoryParameters in interface Schedulable
Parameters:
memory - A MemoryParameters object which will become the memory parameters associated with this after the method call.
Throws:
java.lang.IllegalThreadStateException

setMemoryParametersIfFeasible

public boolean setMemoryParametersIfFeasible(javax.realtime.MemoryParameters memParam)
The method first performs a feasibility analysis using the ginve memory parameters as replacements for the memory parameters of this. If the resulting system is feasible the method replaces the current memory parameters of this with the new memory parameters.

Specified by:
setMemoryParametersIfFeasible in interface Schedulable
Parameters:
memParam - The proposed memory Parameters
Returns:
True, if the resulting system is fesible and the changes are made. False, if the resulting system is not feasible and no changes are made.

setProcessingGroupParameters

public void setProcessingGroupParameters(javax.realtime.ProcessingGroupParameters parameters)
Sets the reference to the ProcessingGroupParameters object.

Specified by:
setProcessingGroupParameters in interface Schedulable
Parameters:
parameters - A reference to the ProcessingGroupParameters object.
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.

setProcessingGroupParametersIfFeasible

public boolean setProcessingGroupParametersIfFeasible(javax.realtime.ProcessingGroupParameters groupParameters)
Sets the ProcessingGroupParameters of this only if the resulting set of scheduling and release characteristics is feasible.

Specified by:
setProcessingGroupParametersIfFeasible in interface Schedulable
Parameters:
groupParameters - The ProcessingGroupParameters object. If null, nothing happens.
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.

setReleaseParameters

public void setReleaseParameters(javax.realtime.ReleaseParameters release)
                          throws java.lang.IllegalThreadStateException
Since this affects the constraints expressed in the release parameters of the existing schedulable objects, this may change the feasibility of the current schedule.

Specified by:
setReleaseParameters in interface Schedulable
Parameters:
release - A ReleaseParameters object which will become the release parameters associated with this afther the method call.
Throws:
java.lang.IllegalThreadStateException - Thrown if the state of this instance of Schedulable is not appropriate to changing the release parameters.

setReleaseParametersIfFeasible

public boolean setReleaseParametersIfFeasible(javax.realtime.ReleaseParameters release)
Set the ReleaseParameters for this schedulable object only if the resulting set of scheduling and release characteristics is feasible.

Specified by:
setReleaseParametersIfFeasible in interface Schedulable
Parameters:
release - The ReleaseParameters object. If null nothing happens.
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.

setScheduler

public void setScheduler(javax.realtime.Scheduler scheduler)
                  throws java.lang.IllegalThreadStateException
Sets the reference to the Scheduler object.

Specified by:
setScheduler in interface Schedulable
Parameters:
scheduler - A reference to the Scheduler object.
Throws:
java.lang.IllegalThreadStateException - Thrown when: ((Thread.isAlive() && Not Blocked) == true). (Where blocked means waiting in Thread.wait(), Thread.join() or Thread.sleep()).

setScheduler

public void setScheduler(javax.realtime.Scheduler scheduler,
                         javax.realtime.SchedulingParameters scheduling,
                         javax.realtime.ReleaseParameters release,
                         javax.realtime.MemoryParameters memParameters,
                         javax.realtime.ProcessingGroupParameters processingGroup)
                  throws java.lang.IllegalThreadStateException
Sets the scheduler and associated parameter objects.

Specified by:
setScheduler in interface Schedulable
Parameters:
scheduler - A reference to the scheduler that will manage the execution of this thread. If null, no change to current value of this parameter is made.
scheduling - A reference to the SchedulingParameters which will be associated with this. If null, no change to current value of this parameter is made.
release - A reference to the ReleasePrameters which will be associated with this. If null, no change to current value of this parameter is made.
memParameters - A reference to the MemoryParaemters which will be associated with this. If null, no change to current value of this parameter is made.
processingGroup - A reference to the ProcessingGroupParameters which will be associated with this. If null, no change to current value of this parameter is made.
Throws:
java.lang.IllegalThreadStateException - Thrown when: ((Thread.isAlive() && Not Blocked) == true). (Where blocked means waiting in Thread.wait(), Thread.join() or Thread.sleep()).

setSchedulingParameters

public void setSchedulingParameters(javax.realtime.SchedulingParameters scheduling)
                             throws java.lang.IllegalThreadStateException
Sets the reference to the SchedulingParameters object.

Specified by:
setSchedulingParameters in interface Schedulable
Parameters:
scheduling - A reference to the SchedulingParameters in interface Schedulable.
Throws:
java.lang.IllegalThreadStateException - Thrown when: ((Thread.isAlive() && Not Blocked) == true). (Where blocked means waiting in Thread.wait(), Thread.join() or Thread.sleep()).

setSchedulingParametersIfFeasible

public boolean setSchedulingParametersIfFeasible(javax.realtime.SchedulingParameters scheduling)
The method first performs a feasiblity analysis using the given scheduling parameters as replacements for the scheduling parameters of this. If the resulting system is feasible the method replaces the current scheduling parameters of this with the new scheduling parameters.

Specified by:
setSchedulingParametersIfFeasible in interface Schedulable
Parameters:
scheduling - The proposed scheduling parameters. If null, nothing happens.
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.

sleep

public static void sleep(javax.realtime.Clock clock,
                         javax.realtime.HighResolutionTime time)
                  throws java.lang.InterruptedException
An accurate timer with nanoseconds granularity. The actual resolution available for the clock must be queried form somewhere else. The time base is the given Clock. The sleep time may be relative of absolute. If relative, then the calling thread is blocked for the amount of time given by the parameter. If absolute, then the calling thread is blocked until the indicated point in time. If the given absolute time is before the current time, the call to sleep returns immediately.

Parameters:
clock - The instance of Clock used as the base.
time - The amount of time to sleep or the point in time at which to awaken.
Throws:
java.lang.InterruptedException - If interrupted.

sleep

public static void sleep(javax.realtime.HighResolutionTime time)
                  throws java.lang.InterruptedException
An accurate timer with nanoseconds granularity. The actual resolution available for the clock must be queried form somewhere else. The time base is the given Clock. The sleep time may be relative of absolute. If relative, then the calling thread is blocked for the amount of time given by the parameter. If absolute, then the calling thread is blocked until the indicated point in time. If the given absolute time is before the current time, the call to sleep returns immediately.

Parameters:
time - The amount of time to sleep or the point in time at which to awaken.
Throws:
java.lang.InterruptedException - If interrupted.

start

public void start()
Starts the thread.

Overrides:
start in class java.lang.Thread

waitForNextPeriod

public boolean waitForNextPeriod()
                          throws java.lang.IllegalThreadStateException
Used by threads that have a reference to a ReleaseParameters type of PeriodicParameters to block until the start of each period. Periods start at either the start time in PeriodicParameters of when this.start() is called. This method will block until the start of the next period unless the thread is in either an overrun or deadline miss condition. If both overrun and miss handlers are null and the thread has overrun its cost of missed a deadline waitForNextPeriod will immediately return false once per overrun or deadline miss. It will then again block until the start of the next period (unless, of course, the thread has overrun of missed again). If either the overrun of deadline miss handlers are not null and the thread is in either an overrun or deadline miss condition waitForNextObject() will block until handler corrects the situation (possibly by calling schedulePeriodic). waitForNextPeriod() throws IllegalThreadStateException if this does not have a reference to a ReleaseParameters type of PeriodicParameters.

Returns:
True when the thread is not in an overrun or deadline miss condition and unblocks at the start of the next period.
Throws:
java.lang.IllegalThreadStateException - If this does not have a reference to a ReleaseParameters type of PeriodicParameters.

bindSchedulable

public void bindSchedulable()
Informs ReleaseParameters, ProcessingGroupParameters and MemoryParameters that this has them as its parameters.


unbindSchedulable

public void unbindSchedulable()
Informs ReleaseParameters, ProcessingGroupParameters and MemoryParameters that this does not have them any longer as its parameters.


activeCount

public static int activeCount()

currentThread

public static java.lang.Thread currentThread()
Returns the current running thread.


enumerate

public static int enumerate(java.lang.Thread[] tarray)
Same as java.lang.Thread.enumerate().


interrupted

public static boolean interrupted()
Same as java.lang.Thread.interrupted().


yield

public static void yield()
Same as java.lang.Thread.yield().


sleep

public static void sleep(long millis)
                  throws java.lang.InterruptedException
Same as java.lang.Thread.sleep(long).

java.lang.InterruptedException

sleep

public static void sleep(long millis,
                         int nanos)
                  throws java.lang.InterruptedException
Same as java.lang.Thread.sleep(long, int).

java.lang.InterruptedException

dumpStack

public static void dumpStack()

run

public void run()
Override the Thread.run() method, because Thread.run() doesn't work.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

memoryArea

public javax.realtime.MemoryArea memoryArea()
For internal use only.


enter

void enter(javax.realtime.MemoryArea mem,
           javax.realtime.MemoryArea original)

exitMem

void exitMem()

cleanup

void cleanup()

outerScope

javax.realtime.MemoryArea outerScope(javax.realtime.MemoryArea child)
Get the outerScope of a given MemoryArea for the current RealtimeThread.


checkAccess

boolean checkAccess(javax.realtime.MemoryArea source,
                    javax.realtime.MemoryArea target)

checkNoHeapWrite

public void checkNoHeapWrite(java.lang.Object obj)

checkNoHeapRead

public void checkNoHeapRead(java.lang.Object obj)

toString

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

schedule

final void schedule()
Schedule this on the thread lists


unschedule

final void unschedule()
Deschedule this from the thread lists