javax.realtime
Class RealtimeThread

java.lang.Object
  extended by java.lang.Thread
      extended by javax.realtime.RealtimeThread
All Implemented Interfaces:
java.lang.Runnable, Schedulable
Direct Known Subclasses:
NoHeapRealtimeThread

public class RealtimeThread
extends java.lang.Thread
implements Schedulable

Class RealtimeThread extends Thread and adds access to real-time services such as asynchronous transfer of control, non-heap memory, and advanced scheduler services.

As with java.lang.Thread, there are two ways to create a usable RealtimeThread.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RealtimeThread()
          Create a real-time thread with default values for all parameters.
RealtimeThread(SchedulingParameters scheduling)
          Create a real-time thread with the given SchedulingParameters and default values for all other parameters.
RealtimeThread(SchedulingParameters scheduling, ReleaseParameters release)
          Create a real-time thread with the given SchedulingParameters and ReleaseParameters and default values for all other parameters.
RealtimeThread(SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, MemoryArea area, ProcessingGroupParameters group, java.lang.Runnable logic)
          Create a real-time thread with the given characteristics and a specified Runnable.
 
Method Summary
 boolean addIfFeasible()
          This method first performs a feasibility analysis with this added to the system.
 boolean addToFeasibility()
          Inform the scheduler and cooperating facilities that this instance of Schedulable should be considered in feasibility analysis until further notified.
static RealtimeThread currentRealtimeThread()
          Gets a reference to the current instance of RealtimeThread.
 void deschedulePeriodic()
          If the ReleaseParameters object associated with this RealtimeThread is an instance of is PeriodicParameters, perform any deschedulePeriodic actions specified by this thread's scheduler.
static MemoryArea getCurrentMemoryArea()
          Return a reference to the MemoryArea object representing the current allocation context.
static int getInitialMemoryAreaIndex()
          Returns the position in the initial memory area stack, of the initial memory area for the current real-time thread.
 MemoryArea getMemoryArea()
          Return the initial memory area for this RealtimeThread (corresponding to the area parameter for the constructor.)
static int getMemoryAreaStackDepth()
          Gets the size of the stack of MemoryArea instances to which the current schedulable object has access.
 MemoryParameters getMemoryParameters()
          Gets a reference to the MemoryParameters object for this schedulable object.
static MemoryArea getOuterMemoryArea(int index)
          Gets the instance of MemoryArea in the memory area stack at the index given.
 ProcessingGroupParameters getProcessingGroupParameters()
          Gets a reference to the ProcessingGroupParameters object for this schedulable object.
 ReleaseParameters getReleaseParameters()
          Gets a reference to the ReleaseParameters object for this schedulable object.
 Scheduler getScheduler()
          Gets a reference to the Scheduler object for this schedulable object.
 SchedulingParameters getSchedulingParameters()
          Gets a reference to the SchedulingParameters object for this schedulable object.
 void interrupt()
          Extends the function of Thread.interrupt(), generates the generic AsynchronouslyInterruptedException and targets it at this, and sets the interrupted state to pending.
 boolean removeFromFeasibility()
          Inform the scheduler and cooperating facilities that this instance of Schedulable should not be considered in feasibility analysis until it is further notified.
 void schedulePeriodic()
          Begin unblocking waitForNextPeriod() for a periodic thread.
 boolean setIfFeasible(ReleaseParameters release, MemoryParameters memory)
          This method first performs a feasibility analysis using the proposed parameter objects as replacements for the current parameters of this.
 boolean setIfFeasible(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 this.
 boolean setIfFeasible(ReleaseParameters release, ProcessingGroupParameters group)
          This method first performs a feasibility analysis using the proposed parameter objects as replacements for the current parameters of this.
 boolean setIfFeasible(SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory)
          This method first performs a feasibility analysis using the proposed parameter objects as replacements for the current parameters of this.
 boolean setIfFeasible(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 this.
 void setMemoryParameters(MemoryParameters memory)
          Sets the memory parameters associated with this instance of Schedulable.
 boolean setMemoryParametersIfFeasible(MemoryParameters memory)
          This method first performs a feasibility analysis using the proposed parameter object as replacement for the current parameter of this.
 void setProcessingGroupParameters(ProcessingGroupParameters group)
          Sets the ProcessingGroupParameters of this.
 boolean setProcessingGroupParametersIfFeasible(ProcessingGroupParameters group)
          This method first performs a feasibility analysis using the proposed parameter object as replacement for the current parameter of this.
 void setReleaseParameters(ReleaseParameters release)
          Sets the release parameters associated with this instance of Schedulable.
 boolean setReleaseParametersIfFeasible(ReleaseParameters release)
          This method first performs a feasibility analysis using the proposed parameter object as replacement for the current parameter of this.
 void setScheduler(Scheduler scheduler)
          Sets the reference to the Scheduler object.
 void setScheduler(Scheduler scheduler, SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memoryParameters, ProcessingGroupParameters group)
          Sets the scheduler and associated parameter objects.
 void setSchedulingParameters(SchedulingParameters scheduling)
          Sets the scheduling parameters associated with this instance of Schedulable.
 boolean setSchedulingParametersIfFeasible(SchedulingParameters scheduling)
          This method first performs a feasibility analysis using the proposed parameter object as replacement for the current parameter of this.
static void sleep(Clock clock, HighResolutionTime time)
          A sleep method that is controlled by a generalized clock.
static void sleep(HighResolutionTime time)
          A sleep method that is controlled by a generalized clock.
 void start()
          Set up the real-time thread's environment and start it.
static boolean waitForNextPeriod()
          Causes the current real-time thread to delay until the beginning of the next period.
static boolean waitForNextPeriodInterruptible()
          The waitForNextPeriodInterruptible() method is a duplicate of waitForNextPeriod() except that waitForNextPeriodInterruptible is able to throw InterruptedException.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 

Constructor Detail

RealtimeThread

public RealtimeThread()
Create a real-time thread with default values for all parameters. This constructor is equivalent to RealtimeThread(null, null, null, null, null, null).


RealtimeThread

public RealtimeThread(SchedulingParameters scheduling)
Create a real-time thread with the given SchedulingParameters and default values for all other parameters. This constructor is equivalent to RealtimeThread(scheduling, null, null, null, null, null).

Throws:
java.lang.IllegalArgumentException - Thrown if the scheduling parameters are not compatible with the associated scheduler.
IllegalAssignmentError - Thrown if the new RealtimeThread instance cannot hold a reference to scheduling, or if scheduling cannot hold a reference to the new RealtimeThread.

RealtimeThread

public RealtimeThread(SchedulingParameters scheduling,
                      ReleaseParameters release)
Create a real-time thread with the given SchedulingParameters and ReleaseParameters and default values for all other parameters. This constructor is equivalent to RealtimeThread(scheduling, release, null, null, null, null).

Throws:
java.lang.IllegalArgumentException - Thrown if the scheduling parameters or release parameters are not compatible with the associated scheduler.
IllegalAssignmentError - Thrown if the new RealtimeThread instance cannot hold a reference to scheduling or release, or if either parameter cannot hold a reference to the new RealtimeThread.

RealtimeThread

public RealtimeThread(SchedulingParameters scheduling,
                      ReleaseParameters release,
                      MemoryParameters memory,
                      MemoryArea area,
                      ProcessingGroupParameters group,
                      java.lang.Runnable logic)
Create a real-time thread with the given characteristics and a specified Runnable. The thread group of the new thread is inherited from its creator unless the newly-created real-time thread is allocated in scoped memory, then its thread group is (effectively) null.

The newly-created real-time thread is associated with the scheduler in effect during execution of the constructor.

Parameters:
scheduling - The SchedulingParameters associated with this (And possibly other instances of Schedulable). If scheduling is null and the creator is a schedulable object, SchedulingParameters is a clone of the creator's value created in the same memory area as this. If scheduling is null and the creator is a Java thread, the contents and type of the new SchedulingParameters object is governed by the associated scheduler.
release - The ReleaseParameters associated with this (and possibly other instances of Schedulable). If release is null the new RealtimeThread will use a clone of the default ReleaseParameters for the associated scheduler created in the memory area that contains the RealtimeThread object.
memory - The MemoryParameters associated with this (and possibly other instances of Schedulable). If memory is null, the new RealtimeThread receives null value for its memory parameters, and the amount or rate of memory allocation for the new thread is unrestricted.
area - The MemoryArea associated with this. If area is null, the initial memory area of the new RealtimeThread is the current memory area at the time the constructor is called.
group - The ProcessingGroupParameters associated with this (and possibly other instances of Schedulable). If null, the new RealtimeThread will not be associated with any processing group.
logic - The Runnable object whose run() method will serve as the logic for the new RealtimeThread. If logic is null, the run() method in the new object will serve as its logic.
Throws:
java.lang.IllegalArgumentException - Thrown if the parameters are not compatible with the associated scheduler.
IllegalAssignmentError - Thrown if the new RealtimeThread instance cannot hold a reference to non-null values of scheduling release memory and group, or if those parameters cannot hold a reference to the new RealtimeThread. Also thrown if the new RealtimeThread instance cannot hold a reference to non-null values of area or logic.
Method Detail

currentRealtimeThread

public static RealtimeThread currentRealtimeThread()
Gets a reference to the current instance of RealtimeThread.

It is permissible to call currentRealtimeThread when control is in an AsyncEventHandler. The method will return a reference to the RealtimeThread supporting that release of the async event handler.

Returns:
A reference to the current instance of RealtimeThread.
Throws:
java.lang.ClassCastException - Thrown if the current execution context is that of a Java thread.

getCurrentMemoryArea

public static MemoryArea getCurrentMemoryArea()
Return a reference to the MemoryArea object representing the current allocation context.

If this method is invoked from a Java thread it will return that thread's current memory area (heap or immortal.)

Returns:
A reference to the MemoryArea object representing the current allocation context.

getInitialMemoryAreaIndex

public static int getInitialMemoryAreaIndex()
Returns the position in the initial memory area stack, of the initial memory area for the current real-time thread. Memory area stacks may include inherited stacks from parent threads. The initial memory area of a RealtimeThread or AsyncEventHandler is the memory area given as a parameter to its constructor. The index in the initial memory area stack of the initial memory area is a fixed property of the real-time thread.

If the current memory area stack of the current real-time thread is not the original stack and the memory area at the initial memory area index is not the initial memory area, then IllegalStateException is thrown.

Returns:
The index into the initial memory area stack of the initial memory area of the current RealtimeThread.
Throws:
java.lang.IllegalStateException - Thrown if the memory area at the initial memory area index, in the current scope stack is not the initial memory area.
java.lang.ClassCastException - Thrown if the current execution context is that of a Java thread.

getMemoryAreaStackDepth

public static int getMemoryAreaStackDepth()
Gets the size of the stack of MemoryArea instances to which the current schedulable object has access.

Note: The current memory area (getCurrentMemoryArea()) is found at memory area stack index getMemoryAreaStackDepth() - 1.

Returns:
The size of the stack of MemoryArea instances.
Throws:
java.lang.ClassCastException - Thrown if the current execution context is that of a Java thread.

getOuterMemoryArea

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

Note: The current memory area (getCurrentMemoryArea()) is found at memory area stack index getMemoryAreaStackDepth() - 1., so getCurrentMemoryArea() == getOutMemoryArea(getMemoryAreaStackDepth() - 1).

Parameters:
index - The offset into the memory area stack.
Returns:
The instance of MemoryArea at index or null if the given value is does not correspond to a position in the stack.
Throws:
java.lang.ClassCastException - Thrown if the current execution context is that of a Java thread.

sleep

public static void sleep(Clock clock,
                         HighResolutionTime time)
                  throws java.lang.InterruptedException
A sleep method that is controlled by a generalized clock. Since the time is expressed as a HighResolutionTime, this method is an accurate timer with nanosecond granularity. The actual resolution available for the clock and even the quantity it measures depends on clock. The time base is the given Clock. The sleep time may be relative or absolute. If relative, then the calling thread is blocked for the amount of time given by time, and measured by clock. If absolute, then the calling thread is blocked until the indicated value is reached by clock. If the given absolute time is less than or equal to the current value of clock, the call to sleep returns immediately.

It is permissible to call sleep when control is in an AsyncEventHandler. The method cause the handler to sleep.

This method must not throw IllegalAssignmentError. It must tolerate time instances that may not be stored in this.

Parameters:
clock - The instance of Clock used as the base. If clock is null the real-time clock (see Clock.getRealtimeClock()) is used. If time uses a time-base other than clock, time is reassociated with clock for purposes of this method.
time - The amount of time to sleep or the point in time at which to awaken.
Throws:
java.lang.InterruptedException - Thrown if the thread is interrupted by interrupt() or AsynchronouslyInterruptedException.fire() during the time between calling this method and returning from it.
java.lang.ClassCastException - Thrown if the current execution context is that of a Java thread.
java.lang.UnsupportedOperationException - Thrown if the sleep operation is not supported by clock.
java.lang.IllegalArgumentException - Thrown if time is null, or if time is a relative time less than zero.

sleep

public static void sleep(HighResolutionTime time)
                  throws java.lang.InterruptedException
A sleep method that is controlled by a generalized clock. Since the time is expressed as a HighResolutionTime, this method is an accurate timer with nanosecond granularity. The actual resolution available for the timer and even the quantity it measures depends on the clock associated with time. The sleep time may be relative or absolute. If relative, then the calling thread is blocked for the amount of time given by time, and measured by the clock associated with time. If absolute, then the calling thread is blocked until the indicated value is reached by the associated clock. If the given absolute time is less than or equal to the current value of the clock, the call to sleep returns immediately.

It is permissible to call sleep when control is in an AsyncEventHandler. The method cause the handler to sleep.

This method must not throw IllegalAssignmentError. It must tolerate time instances that may not be stored in this.

Parameters:
time - The amount of time to sleep or the point in time at which to awaken.
Throws:
java.lang.InterruptedException - Thrown if the thread is interrupted by interrupt() or AsynchronouslyInterruptedException.fire() during the time between calling this method and returning from it.
java.lang.ClassCastException - Thrown if the current execution context is that of a Java thread.
java.lang.UnsupportedOperationException - Thrown if the sleep operation is not supported using the clock associated with time.
java.lang.IllegalArgumentException - Thrown if time is null, or if time is a relative time less than zero.

waitForNextPeriod

public static boolean waitForNextPeriod()
Causes the current real-time thread to delay until the beginning of the next period. Used by threads that have a reference to a ReleaseParameters type of PeriodicParameters to block until the start of each period. The first period starts when this thread is first released. Each time it is called this method will block until the start of the next period unless the thread is in a deadline miss condition. In that case the operation of waitForNextPeriod is controlled by this thread's scheduler. (See Priority Scheduler.)

Returns:
True when the thread is not in a deadline miss condition. Otherwise the return value is governed by this thread's scheduler.
Throws:
java.lang.IllegalThreadStateException - Thrown if this does not have a reference to a ReleaseParameters type of PeriodicParameters.
java.lang.ClassCastException - Thrown if the current thread is not an instance of RealtimeThread.
Since:
1.0.1 Changed from an instance method to a static method.

waitForNextPeriodInterruptible

public static boolean waitForNextPeriodInterruptible()
                                              throws java.lang.InterruptedException
The waitForNextPeriodInterruptible() method is a duplicate of waitForNextPeriod() except that waitForNextPeriodInterruptible is able to throw InterruptedException.

Used by threads that have a reference to a ReleaseParameters type of PeriodicParameters to block until the start of each period. The first period starts when this thread is first released. Each time it is called this method will block until the start of the next period unless the thread is in a deadline miss condition. In that case the operation of waitForNextPeriodInterruptible is controlled by this thread's scheduler. (See Priority Scheduler.)

Returns:
True when the thread is not in a deadline miss condition. Otherwise the return value is governed by this thread's scheduler.
Throws:
java.lang.InterruptedException - Thrown if the thread is interrupted by interrupt() or AsynchronouslyInterruptedException.fire() during the time between calling this method and returning from it.

An interrupt during waitForNextPeriodInterruptible is treated as a release for purposes of scheduling. This is likely to disrupt proper operation of the periodic thread. The periodic behavior of the thread is unspecified until the state is reset by altering the thread's periodic parameters.

java.lang.ClassCastException - Thrown if the current thread is not an instance of RealtimeThread.
java.lang.IllegalThreadStateException - Thrown if this does not have a reference to a ReleaseParameters type of PeriodicParameters.
Since:
1.0.1

addIfFeasible

public boolean addIfFeasible()
This method first performs a feasibility analysis with this added to the system. If the resulting system is feasible, inform the scheduler and cooperating facilities that this instance of Schedulable should be considered in feasibility analysis until further notified. If the analysis showed that the system including this would not be feasible, this method does not admit this to the feasibility set.

If the object is already included in the feasibility set, do nothing.

Specified by:
addIfFeasible in interface Schedulable
Returns:
True if inclusion of this in the feasibility set yields a feasible system, and false otherwise. If true is returned then this is known to be in the feasibility set. If false is returned this was not added to the feasibility set, but may already have been present.

addToFeasibility

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

If the object is already included in the feasibility set, do nothing.

Specified by:
addToFeasibility in interface Schedulable
Returns:
True, if the resulting system is feasible. False, if not.

deschedulePeriodic

public void deschedulePeriodic()
If the ReleaseParameters object associated with this RealtimeThread is an instance of is PeriodicParameters, perform any deschedulePeriodic actions specified by this thread's scheduler. If the type of the associated instance of ReleaseParameters is not PeriodicParameters nothing happens.


getMemoryArea

public MemoryArea getMemoryArea()
Return the initial memory area for this RealtimeThread (corresponding to the area parameter for the constructor.)

Note: Unlike the scheduling-related parameter objects, there is never a case where a default parameter will be constructed for the thread. The default is a reference to the current allocation context when this is constructed.

Returns:
A reference to the initial memory area for this thread.
Since:
1.0.1

getMemoryParameters

public MemoryParameters getMemoryParameters()
Gets a reference to the MemoryParameters object for this schedulable object.

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

getProcessingGroupParameters

public ProcessingGroupParameters getProcessingGroupParameters()
Gets a reference to the ProcessingGroupParameters object for this schedulable object.

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

getReleaseParameters

public ReleaseParameters getReleaseParameters()
Gets a reference to the ReleaseParameters object for this schedulable object.

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

getScheduler

public Scheduler getScheduler()
Gets a reference to the Scheduler object for this schedulable object.

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

getSchedulingParameters

public SchedulingParameters getSchedulingParameters()
Gets a reference to the SchedulingParameters object for this schedulable object.

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

interrupt

public void interrupt()
Extends the function of Thread.interrupt(), generates the generic AsynchronouslyInterruptedException and targets it at this, and sets the interrupted state to pending. (See AsynchronouslyInterruptedException.

The semantics of Thread.interrupt() are preserved.

Overrides:
interrupt in class java.lang.Thread

removeFromFeasibility

public boolean removeFromFeasibility()
Inform the scheduler and cooperating facilities that this instance of Schedulable should not be considered in feasibility analysis until it is further notified.

Specified by:
removeFromFeasibility in interface Schedulable
Returns:
True, if the removal was successful. False, if the schedulable object cannot be removed from the scheduler's feasibility set; e.g., the schedulable object is not part of the scheduler's feasibility set.

schedulePeriodic

public void schedulePeriodic()
Begin unblocking waitForNextPeriod() for a periodic thread. If deadline miss detection is disabled, enable it. Typically used when a periodic schedulable object is in a deadline miss condition.

The details of the interaction of this method with deschedulePeriodic() and waitForNextPeriod() are dictated by this thread's scheduler.

If this RealtimeThread does not have a type of PeriodicParameters as its ReleaseParameters nothing happens.


setIfFeasible

public boolean setIfFeasible(ReleaseParameters release,
                             MemoryParameters memory)
This method first performs a feasibility analysis using the proposed parameter objects as replacements for the current parameters of this. If the resulting system is feasible, this method replaces the current parameters of this with the proposed ones.

This change becomes effective under conditions determined by the scheduler controlling the schedulable object. For instance, the change may be immediate or it may be delayed until the next release of the schedulable object. See the documentation for the scheduler for details.

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.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
release - The proposed release parameters. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
memory - The proposed memory parameters. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
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.
Throws:
java.lang.IllegalArgumentException - Thrown when the parameter values are not compatible with the schedulable object's scheduler. Also thrown if this schedulable object is no-heap and any of the proposed parameter objects are located in heap memory.
IllegalAssignmentError - Thrown if this cannot hold references to the proposed parameter objects, or the parameter objects cannot hold a reference to this.
java.lang.IllegalThreadStateException - Thrown if the new release parameters change the schedulable object from periodic scheduling to some other protocol and the schedulable object is currently waiting for the next release in waitForNextPeriod() or waitForNextPeriodInterruptible().

setIfFeasible

public boolean setIfFeasible(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 this. If the resulting system is feasible, this method replaces the current parameters of this with the proposed ones.

This change becomes effective under conditions determined by the scheduler controlling the schedulable object. For instance, the change may be immediate or it may be delayed until the next release of the schedulable object. See the documentation for the scheduler for details.

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.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
release - The proposed release parameters. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
memory - The proposed memory parameters. If null, the default value is governed by the associated scheduler (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 is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
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.
Throws:
java.lang.IllegalArgumentException - Thrown when the parameter values are not compatible with the schedulable object's scheduler. Also thrown if this schedulable object is no-heap and any of the proposed parameter objects are located in heap memory.
IllegalAssignmentError - Thrown if this cannot hold references to the proposed parameter objects, or the parameter objects cannot hold a reference to this.
java.lang.IllegalThreadStateException - Thrown if the new release parameters change the schedulable object from periodic scheduling to some other protocol and the schedulable object is currently waiting for the next release in waitForNextPeriod() or waitForNextPeriodInterruptible().

setIfFeasible

public boolean setIfFeasible(ReleaseParameters release,
                             ProcessingGroupParameters group)
This method first performs a feasibility analysis using the proposed parameter objects as replacements for the current parameters of this. If the resulting system is feasible, this method replaces the current parameters of this with the proposed ones.

This change becomes effective under conditions determined by the scheduler controlling the schedulable object. For instance, the change may be immediate or it may be delayed until the next release of the schedulable object. See the documentation for the scheduler for details.

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.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
release - The proposed release parameters. If null, the default value is governed by the associated scheduler (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 is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
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.
Throws:
java.lang.IllegalArgumentException - Thrown when the parameter values are not compatible with the schedulable object's scheduler. Also thrown if this schedulable object is no-heap and any of the proposed parameter objects are located in heap memory.
IllegalAssignmentError - Thrown if this cannot hold references to the proposed parameter objects, or the parameter objects cannot hold a reference to this.
java.lang.IllegalThreadStateException - Thrown if the new release parameters change the schedulable object from periodic scheduling to some other protocol and the schedulable object is currently waiting for the next release in waitForNextPeriod() or waitForNextPeriodInterruptible().

setIfFeasible

public boolean setIfFeasible(SchedulingParameters scheduling,
                             ReleaseParameters release,
                             MemoryParameters memory)
This method first performs a feasibility analysis using the proposed parameter objects as replacements for the current parameters of this. If the resulting system is feasible, this method replaces the current parameters of this with the proposed ones.

This change becomes effective under conditions determined by the scheduler controlling the schedulable object. For instance, the change may be immediate or it may be delayed until the next release of the schedulable object. See the documentation for the scheduler for details.

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.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
scheduling - The proposed scheduling parameters. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
release - The proposed release parameters. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
memory - The proposed memory parameters. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
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.
Throws:
java.lang.IllegalArgumentException - Thrown when the parameter values are not compatible with the schedulable object's scheduler. Also thrown if this schedulable object is no-heap and any of the proposed parameter objects are located in heap memory.
IllegalAssignmentError - Thrown if this cannot hold references to the proposed parameter objects, or the parameter objects cannot hold a reference to this.
java.lang.IllegalThreadStateException - Thrown if the new release parameters change the schedulable object from periodic scheduling to some other protocol and the schedulable object is currently waiting for the next release in waitForNextPeriod() or waitForNextPeriodInterruptible().

setIfFeasible

public boolean setIfFeasible(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 this. If the resulting system is feasible, this method replaces the current parameters of this with the proposed ones.

This change becomes effective under conditions determined by the scheduler controlling the schedulable object. For instance, the change may be immediate or it may be delayed until the next release of the schedulable object. See the documentation for the scheduler for details.

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.

Specified by:
setIfFeasible in interface Schedulable
Parameters:
scheduling - The proposed scheduling parameters. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
release - The proposed release parameters. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
memory - The proposed memory parameters. If null, the default value is governed by the associated scheduler (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 is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
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.
Throws:
java.lang.IllegalArgumentException - Thrown when the parameter values are not compatible with the schedulable object's scheduler. Also thrown if this schedulable object is no-heap and any of the proposed parameter objects are located in heap memory.
IllegalAssignmentError - Thrown if this cannot hold references to the proposed parameter objects, or the parameter objects cannot hold a reference to this.
java.lang.IllegalThreadStateException - Thrown if the new release parameters change the schedulable object from periodic scheduling to some other protocol and the schedulable object is currently waiting for the next release in waitForNextPeriod() or waitForNextPeriodInterruptible().

setMemoryParameters

public void setMemoryParameters(MemoryParameters memory)
Sets the memory parameters associated with this instance of Schedulable.

This change becomes effective under conditions determined by the scheduler controlling the schedulable object. For instance, the change may be immediate or it may be delayed until the next release of the schedulable object. See the documentation for the scheduler for details.

Since this affects the constraints expressed in the memory parameters of the existing schedulable objects, this may change the feasibility of the current system.

Specified by:
setMemoryParameters in interface Schedulable
Parameters:
memory - A MemoryParameters object which will become the memory parameters associated with this after the method call. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
Throws:
java.lang.IllegalArgumentException - Thrown if memory is not compatible with the schedulable object's scheduler. Also thrown if this schedulable object is no-heap and memory is located in heap memory.
IllegalAssignmentError - Thrown if the schedulable object cannot hold a reference to memory, or if memory cannot hold a reference to this schedulable object instance.

setMemoryParametersIfFeasible

public boolean setMemoryParametersIfFeasible(MemoryParameters memory)
This method first performs a feasibility analysis using the proposed parameter object as replacement for the current parameter of this. If the resulting system is feasible, this method replaces the current parameter of this with the proposed one.

This change becomes effective under conditions determined by the scheduler controlling the schedulable object. For instance, the change may be immediate or it may be delayed until the next release of the schedulable object. See the documentation for the scheduler for details.

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.

Specified by:
setMemoryParametersIfFeasible in interface Schedulable
Parameters:
memory - The proposed memory parameters. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
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.
Throws:
java.lang.IllegalArgumentException - Thrown when the parameter value is not compatible with the schedulable object's scheduler. Also thrown if this schedulable object is no-heap and the proposed parameter object is located in heap memory.
IllegalAssignmentError - Thrown if this cannot hold a reference to the proposed parameter object, or the parameter object cannot hold a reference to this.

setProcessingGroupParameters

public void setProcessingGroupParameters(ProcessingGroupParameters group)
Sets the ProcessingGroupParameters of this.

This change becomes effective under conditions determined by the scheduler controlling the schedulable object. For instance, the change may be immediate or it may be delayed until the next release of the schedulable object. See the documentation for the scheduler for details.

Since this affects the constraints expressed in the processing group parameters of the existing schedulable objects, this may change the feasibility of the current system.

Specified by:
setProcessingGroupParameters in interface Schedulable
Parameters:
group - A ProcessingGroupParameters object which will take effect as determined by the associated scheduler. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
Throws:
java.lang.IllegalArgumentException - Thrown when group is not compatible with the scheduler for this schedulable object. Also thrown if this schedulable object is no-heap and group is located in heap memory.
IllegalAssignmentError - Thrown if this object cannot hold a reference to group or group cannot hold a reference to this.

setProcessingGroupParametersIfFeasible

public boolean setProcessingGroupParametersIfFeasible(ProcessingGroupParameters group)
This method first performs a feasibility analysis using the proposed parameter object as replacement for the current parameter of this. If the resulting system is feasible, this method replaces the current parameter of this with the proposed one.

This change becomes effective under conditions determined by the scheduler controlling the schedulable object. For instance, the change may be immediate or it may be delayed until the next release of the schedulable object. See the documentation for the scheduler for details.

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.

Specified by:
setProcessingGroupParametersIfFeasible in interface Schedulable
Parameters:
group - The proposed processing group parameters. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
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.
Throws:
java.lang.IllegalArgumentException - Thrown when the parameter value is not compatible with the schedulable object's scheduler. Also thrown if this schedulable object is no-heap and the proposed parameter object is located in heap memory.
IllegalAssignmentError - Thrown if this cannot hold a reference to the proposed parameter object, or the parameter object cannot hold a reference to this.

setReleaseParameters

public void setReleaseParameters(ReleaseParameters release)
Sets the release parameters associated with this instance of Schedulable.

Since this affects the constraints expressed in the release parameters of the existing schedulable objects, this may change the feasibility of the current system.

This change becomes effective under conditions determined by the scheduler controlling the schedulable object. For instance, the change may be immediate or it may be delayed until the next release of the schedulable object. The different properties of the release parameters may take effect at different times. See the documentation for the scheduler for details.

Specified by:
setReleaseParameters in interface Schedulable
Parameters:
release - A ReleaseParameters object which will become the release parameters associated with this after the method call, and take effect as determined by the associated scheduler. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
Throws:
java.lang.IllegalArgumentException - Thrown when release is not compatible with the associated scheduler. Also thrown if this schedulable object is no-heap and release is located in heap memory.
IllegalAssignmentError - Thrown if this object cannot hold a reference to release or release cannot hold a reference to this.
java.lang.IllegalThreadStateException - Thrown if the new release parameters change the schedulable object from periodic scheduling to some other protocol and the schedulable object is currently waiting for the next release in waitForNextPeriod() or waitForNextPeriodInterruptible().

setReleaseParametersIfFeasible

public boolean setReleaseParametersIfFeasible(ReleaseParameters release)
This method first performs a feasibility analysis using the proposed parameter object as replacement for the current parameter of this. If the resulting system is feasible, this method replaces the current parameter of this with the proposed one.

This change becomes effective under conditions determined by the scheduler controlling the schedulable object. For instance, the change may be immediate or it may be delayed until the next release of the schedulable object. See the documentation for the scheduler for details.

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.

Specified by:
setReleaseParametersIfFeasible in interface Schedulable
Parameters:
release - The proposed release parameters. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
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.
Throws:
java.lang.IllegalArgumentException - Thrown when the parameter value is not compatible with the schedulable object's scheduler. Also thrown if this schedulable object is no-heap and the proposed parameter object is located in heap memory.
IllegalAssignmentError - Thrown if this cannot hold a reference to the proposed parameter object, or the parameter object cannot hold a reference to this.
java.lang.IllegalThreadStateException - Thrown if the new release parameters change the schedulable object from periodic scheduling to some other protocol and the schedulable object is currently waiting for the next release in waitForNextPeriod() or waitForNextPeriodInterruptible().

setScheduler

public void setScheduler(Scheduler scheduler)
Sets the reference to the Scheduler object. The timing of the change must be agreed between the scheduler currently associated with this schedulable object, and scheduler.

Specified by:
setScheduler in interface Schedulable
Parameters:
scheduler - A reference to the scheduler that will manage execution of this schedulable object. Null is not a permissible value.
Throws:
java.lang.IllegalArgumentException - Thrown when scheduler is null, or the schedulable object's existing parameter values are not compatible with scheduler. Also thrown if this schedulable object is no-heap and scheduler is located in heap memory.
IllegalAssignmentError - Thrown if the schedulable object cannot hold a reference to scheduler.
java.lang.SecurityException - Thrown if the caller is not permitted to set the scheduler for this schedulable object.

setScheduler

public void setScheduler(Scheduler scheduler,
                         SchedulingParameters scheduling,
                         ReleaseParameters release,
                         MemoryParameters memoryParameters,
                         ProcessingGroupParameters group)
Sets the scheduler and associated parameter objects. The timing of the change must be agreed between the scheduler currently associated with this schedulable object, and scheduler.

Specified by:
setScheduler in interface Schedulable
Parameters:
scheduler - A reference to the scheduler that will manage the execution of this schedulable object. Null is not a permissible value.
scheduling - A reference to the SchedulingParameters which will be associated with this. If null, the default value is governed by scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
release - A reference to the ReleaseParameters which will be associated with this. If null, the default value is governed by scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
memoryParameters - A reference to the MemoryParameters which will be associated with this. If null, the default value is governed by scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
group - A reference to the ProcessingGroupParameters which will be associated with this. If null, the default value is governed by scheduler (a new object is created). (See PriorityScheduler.)
Throws:
java.lang.IllegalArgumentException - Thrown when scheduler is null or the parameter values are not compatible with scheduler. Also thrown when this schedulable object is no-heap and scheduler, scheduling release, memoryParameters, or group is located in heap memory.
IllegalAssignmentError - Thrown if this object cannot hold references to all the parameter objects or the parameters cannot hold references to this.
java.lang.IllegalThreadStateException - Thrown if the new release parameters change the schedulable object from periodic scheduling to some other protocol and the schedulable object is currently waiting for the next release in waitForNextPeriod() or waitForNextPeriodInterruptible().
java.lang.SecurityException - Thrown if the caller is not permitted to set the scheduler for this schedulable object.

setSchedulingParameters

public void setSchedulingParameters(SchedulingParameters scheduling)
Sets the scheduling parameters associated with this instance of Schedulable.

Since this affects the scheduling parameters of the existing schedulable objects, this may change the feasibility of the current system.

This change becomes effective under conditions determined by the scheduler controlling the schedulable object. For instance, the change may be immediate or it may be delayed until the next release of the schedulable object. See the documentation for the scheduler for details.

Specified by:
setSchedulingParameters in interface Schedulable
Parameters:
scheduling - A reference to the SchedulingParameters object. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
Throws:
java.lang.IllegalArgumentException - Thrown when scheduling is not compatible with the associated scheduler. Also thrown if this schedulable object is no-heap and scheduling is located in heap memory.
IllegalAssignmentError - Thrown if this object cannot hold a reference to scheduling or scheduling cannot hold a reference to this.

setSchedulingParametersIfFeasible

public boolean setSchedulingParametersIfFeasible(SchedulingParameters scheduling)
This method first performs a feasibility analysis using the proposed parameter object as replacement for the current parameter of this. If the resulting system is feasible, this method replaces the current parameter of this with the proposed one.

This change becomes effective under conditions determined by the scheduler controlling the schedulable object. For instance, the change may be immediate or it may be delayed until the next release of the schedulable object. See the documentation for the scheduler for details.

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.

Specified by:
setSchedulingParametersIfFeasible in interface Schedulable
Parameters:
scheduling - The proposed scheduling parameters. If null, the default value is governed by the associated scheduler (a new object is created if the default value is not null). (See PriorityScheduler.)
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.
Throws:
java.lang.IllegalArgumentException - Thrown when the parameter value is not compatible with the schedulable object's scheduler. Also thrown if this schedulable object is no-heap and the proposed parameter object is located in heap memory.
IllegalAssignmentError - Thrown if this cannot hold a reference to the proposed parameter object, or the parameter object cannot hold a reference to this.

start

public void start()
Set up the real-time thread's environment and start it. The set up might include delaying it until the assigned start time and initializing the thread's scope stack. (See ScopedMemory.)

Overrides:
start in class java.lang.Thread