public class RealtimeThread extends java.lang.Thread implements BoundSchedulable
RealtimeThread extends Thread and adds access
to realtime services such as advanced scheduling, affinity
management, asynchronous transfer of control, and access to scope
memory.
As with java.lang.Thread, there are two ways to create a
RealtimeThread.
RealtimeThread and override the run() method with
the logic for the thread.RealtimeThread using one of
the constructors with a logic parameter. Pass a
Runnable object whose run() method
implements the logic of the thread.RealtimeThreadGroup, and it
is not possible to add a RealtimeThread from within a regular ThreadGroup.RealtimeThreadGroup| Constructor and Description |
|---|
RealtimeThread()
Creates a realtime thread with default values for all parameters.
|
RealtimeThread(SchedulingParameters scheduling)
Creates a realtime thread with the given
SchedulingParameters
and default values for all other parameters. |
RealtimeThread(SchedulingParameters scheduling,
ReleaseParameters<?> release)
Creates a realtime thread with the given
SchedulingParameters
and ReleaseParameters
and default values for all other parameters. |
RealtimeThread(SchedulingParameters scheduling,
ReleaseParameters<?> release,
ConfigurationParameters config)
Creates a realtime thread with the given
SchedulingParameters,
ReleaseParameters and MemoryArea
and default values for all other parameters. |
RealtimeThread(SchedulingParameters scheduling,
ReleaseParameters<?> release,
ConfigurationParameters config,
java.lang.Runnable logic)
Creates a realtime thread with the given
SchedulingParameters,
ReleaseParameters, MemoryArea and a specified
Runnable and default values for all other parameters. |
RealtimeThread(SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryArea area,
ConfigurationParameters config)
Creates a realtime thread with the given
SchedulingParameters,
ReleaseParameters, MemoryArea, and
ConfigurationParameters with default values
for all other parameters. |
RealtimeThread(SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory,
MemoryArea area,
ConfigurationParameters config,
RealtimeThreadGroup group,
java.lang.Runnable logic)
Creates a realtime thread with the given characteristics and a
specified
Runnable. |
RealtimeThread(SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory,
MemoryArea area,
ProcessingGroupParameters group,
java.lang.Runnable logic)
Deprecated.
since RTSJ 2.0
|
RealtimeThread(SchedulingParameters scheduling,
ReleaseParameters<?> release,
java.lang.Runnable logic)
Creates a realtime thread with the given
SchedulingParameters,
ReleaseParameters and a specified Runnable
and default values for all other parameters. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addIfFeasible()
Deprecated.
as of RTSJ 2.0, because the framework for feasibility
analysis is inadequate.
|
boolean |
addToFeasibility()
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis is inadequate
|
static RealtimeThread |
currentRealtimeThread()
Gets a reference to the current instance of
RealtimeThread. |
static Schedulable |
currentSchedulable()
Gets a reference to the current instance of
Schedulable. |
void |
deschedule()
Performs any deschedule actions specified by this thread's
scheduler, either immediately when in
waitForNextRelease()
or the next time the thread enters waitForNextRelease(). |
void |
deschedulePeriodic()
Deprecated.
since RTSJ 2.0
|
ConfigurationParameters |
getConfigurationParameters()
Gets a reference to the
ConfigurationParameters
object for this schedulable. |
static MemoryArea |
getCurrentMemoryArea()
Gets a reference to the
MemoryArea object representing the
current allocation context. |
static AbsoluteTime |
getCurrentReleaseTime()
Gets the absolute time of this thread's last release, whether
periodic or aperiodic.
|
static AbsoluteTime |
getCurrentReleaseTime(AbsoluteTime dest)
Gets the absolute time of this thread's last release, whether
periodic or aperiodic.
|
AbsoluteTime |
getEffectiveStartTime()
Equivalent to
getEffectiveStartTime(null). |
AbsoluteTime |
getEffectiveStartTime(AbsoluteTime dest)
Determines the effective start time of this realtime thread.
|
static int |
getInitialMemoryAreaIndex()
Deprecated.
as of RTSJ 2.0.
|
MemoryArea |
getMemoryArea()
Obtains the initial memory area for this
RealtimeThread. |
static int |
getMemoryAreaStackDepth()
Deprecated.
as of RTSJ 2.0
|
MemoryParameters |
getMemoryParameters()
Gets a reference to the
MemoryParameters object for this
schedulable. |
static MemoryArea |
getOuterMemoryArea(int index)
Deprecated.
|
ProcessingGroupParameters |
getProcessingGroupParameters()
Deprecated.
since RTSJ 2.0
|
ReleaseParameters<?> |
getReleaseParameters()
Gets a reference to the
ReleaseParameters object for this
schedulable. |
Scheduler |
getScheduler()
Gets a reference to the
Scheduler object for this
schedulable. |
SchedulingParameters |
getSchedulingParameters()
Gets a reference to the
SchedulingParameters object for this
schedulable. |
void |
interrupt() |
boolean |
isInterrupted() |
boolean |
mayUseHeap()
Determines whether or not this
schedulable may use the heap. |
void |
release()
Generates a release for this
RealtimeThread. |
boolean |
removeFromFeasibility()
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis is inadequate
|
void |
reschedule()
Gets the thread to the blocked-for-next-release state.
|
void |
schedulePeriodic()
Deprecated.
since RTSJ 2.0
|
boolean |
setIfFeasible(ReleaseParameters<?> release,
MemoryParameters memory)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis
is inadequate.
|
boolean |
setIfFeasible(ReleaseParameters<?> release,
MemoryParameters memory,
ProcessingGroupParameters group)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis is
inadequate.
|
boolean |
setIfFeasible(ReleaseParameters<?> release,
ProcessingGroupParameters group)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis
is inadequate.
|
boolean |
setIfFeasible(SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis is
inadequate.
|
boolean |
setIfFeasible(SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memory,
ProcessingGroupParameters group)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis is
inadequate.
|
Schedulable |
setMemoryParameters(MemoryParameters memory)
Sets the memory parameters associated with this instance of
Schedulable. |
boolean |
setMemoryParametersIfFeasible(MemoryParameters memory)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis
is inadequate
|
void |
setProcessingGroupParameters(ProcessingGroupParameters group)
Deprecated.
|
boolean |
setProcessingGroupParametersIfFeasible(ProcessingGroupParameters group)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis
is inadequate.
|
Schedulable |
setReleaseParameters(ReleaseParameters<?> release)
Sets the release parameters associated with this instance of
Schedulable. |
boolean |
setReleaseParametersIfFeasible(ReleaseParameters<?> release)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis is
inadequate.
|
Schedulable |
setScheduler(Scheduler scheduler)
Sets the reference to the Scheduler object.
|
Schedulable |
setScheduler(Scheduler scheduler,
SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memoryParameters)
Sets the scheduler and associated parameter objects.
|
void |
setScheduler(Scheduler scheduler,
SchedulingParameters scheduling,
ReleaseParameters<?> release,
MemoryParameters memoryParameters,
ProcessingGroupParameters group)
Deprecated.
since RTSJ 2.0
|
Schedulable |
setSchedulingParameters(SchedulingParameters scheduling)
Sets the scheduling parameters associated with this instance of
Schedulable. |
boolean |
setSchedulingParametersIfFeasible(SchedulingParameters scheduling)
Deprecated.
as of RTSJ 2.0 The framework for feasibility analysis
is inadequate.
|
static void |
sleep(Clock clock,
HighResolutionTime<?> time)
Deprecated.
in RTSJ 2.0
|
static void |
sleep(HighResolutionTime<?> time)
A sleep method that is controlled by a generalized clock.
|
void |
start()
Sets up the realtime thread's environment and starts it.
|
void |
startPeriodic(PhasingPolicy phasingPolicy)
Starts the periodic thread with the specified phasing policy.
|
boolean |
subsumes(Schedulable other)
Determine whether or not this instance of
Schedulable is
more eligible than other. |
static boolean |
waitForNextPeriod()
Deprecated.
RTSJ 2.0 Replaced by
waitForNextRelease() |
static boolean |
waitForNextPeriodInterruptible()
Deprecated.
RTSJ 2.0 Replaced by
waitForNextReleaseInterruptible() |
static boolean |
waitForNextRelease()
Causes the current realtime thread to delay until the next release.
|
static boolean |
waitForNextReleaseInterruptible()
Same as
waitForNextRelease() except it can throw an interrupted
exception |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yieldequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisDaemon, setDaemonpublic RealtimeThread(SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory, MemoryArea area, ConfigurationParameters config, RealtimeThreadGroup group, java.lang.Runnable logic)
Runnable. The realtime thread group of the new
thread is inherited from its parent task unless group is set.
The newly-created realtime thread is associated with the
scheduler in effect during execution of the constructor.scheduling - The SchedulingParameters associated with
this (And possibly other instances of Schedulable). When scheduling is
null and the creator is a schedulable,
SchedulingParameters is a clone of the creator's
value created in the same memory area as this.
When 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). When 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). When 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, and it may access the heap.area - The initial MemoryArea of this handler.config - The ConfigurationParameters associated
with this (and possibly other instances
of Schedulable). When config is
null, this RealtimeThread
will reserve no space for preallocated exceptions and
implementation-specific values will be set to their
implementation-defined defaults.group - The RealtimeThreadGroup of the newly created
realtime thread or the parent's realtime thread group
when null.logic - The Runnable object whose
run() method will serve as the logic for the
new RealtimeThread. When logic is
null, the run() method in the new
object will serve as its logic.StaticIllegalArgumentException - when the parameters are not
compatible with the associated scheduler.IllegalAssignmentError - when the new
RealtimeThread instance cannot hold a
reference to any of the values of scheduling,
release, memory, or group,
when those parameters cannot hold a
reference to the new RealtimeThread,
when the new RealtimeThread instance cannot
hold a reference to the values of area or
logic, when the initial memory area is not specified
and the new RealtimeThread
instance cannot hold a reference to the default initial
memory area, and
when the thread may not use the heap, as specified by its
memory parameters, and any of the following is true:
ScopedCycleException - when memory is a scoped memory area
that has already been entered from a memory area other than the
current scope.StaticIllegalStateException - when the ThreadGroup of
the calling thread is not an instance of
RealtimeThreadGroup and the argument is null.public RealtimeThread(SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryArea area, ConfigurationParameters config)
SchedulingParameters,
ReleaseParameters, MemoryArea, and
ConfigurationParameters with default values
for all other parameters.
This constructor is equivalent to RealtimeThread(scheduling,
release, null, area, config, null, null, null).
public RealtimeThread(SchedulingParameters scheduling, ReleaseParameters<?> release, ConfigurationParameters config, java.lang.Runnable logic)
SchedulingParameters,
ReleaseParameters, MemoryArea and a specified
Runnable and default values for all other parameters.
This constructor is equivalent to
RealtimeThread(SchedulingParameters, ReleaseParameters,
MemoryParameters, MemoryArea, ConfigurationParameters,
RealtimeThreadGroup, Runnable)
with values scheduling, release, null, null, config, null,
null, logic.
public RealtimeThread(SchedulingParameters scheduling, ReleaseParameters<?> release, ConfigurationParameters config)
SchedulingParameters,
ReleaseParameters and MemoryArea
and default values for all other parameters.
This constructor is equivalent to
RealtimeThread(scheduling, release, null, null, config, null, null).
public RealtimeThread(SchedulingParameters scheduling, ReleaseParameters<?> release, java.lang.Runnable logic)
SchedulingParameters,
ReleaseParameters and a specified Runnable
and default values for all other parameters.
This constructor is equivalent to
RealtimeThread(scheduling, release, null, null, null, null, logic).
public RealtimeThread(SchedulingParameters scheduling, ReleaseParameters<?> release)
SchedulingParameters
and ReleaseParameters
and default values for all other parameters.
This constructor is equivalent to
RealtimeThread(scheduling, release, null, null, null, null, null).
public RealtimeThread(SchedulingParameters scheduling)
SchedulingParameters
and default values for all other parameters.
This constructor is equivalent to
RealtimeThread(scheduling, null, null, null, null, null, null).
public RealtimeThread()
RealtimeThread(null, null, null, null, null, null, null).@Deprecated public RealtimeThread(SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory, MemoryArea area, ProcessingGroupParameters group, java.lang.Runnable logic)
RealtimeThread(scheduling, release, memory,
area, null, group, null, null, logic).StaticIllegalStateException - when the ThreadGroup of
the calling thread is not an instance of
RealtimeThreadGroup.public static RealtimeThread currentRealtimeThread() throws java.lang.ClassCastException
RealtimeThread.
Calling currentRealtimeThread is permissible when
control is in an AsyncEventHandler. The method will
return a reference to the RealtimeThread supporting that
release of the async event handler.
RealtimeThread.java.lang.ClassCastException - when the current execution context
is not an instance of Schedulable.public static Schedulable currentSchedulable() throws java.lang.ClassCastException
Schedulable. It
behaves the same when the current thread is an instance of
java.lang.Thread, but otherwise it produces an instance of
AsyncBaseEventHandler.Schedulable.java.lang.ClassCastException - when the current execution context
is that of a conventional Java thread.public static AbsoluteTime getCurrentReleaseTime()
The clock in the returned absolute time shall be the realtime clock for aperiodic releases and the clock used for the periodic release for periodic releases.
public static AbsoluteTime getCurrentReleaseTime(AbsoluteTime dest)
The clock in the returned absolute time shall be the realtime clock for aperiodic releases and the clock used for the periodic release for periodic releases.
dest, - when not null,
contains the last release timedest. When
dest is null, create a new
absolute time instance in the current memory area.public static MemoryArea getCurrentMemoryArea()
MemoryArea object representing the
current allocation context.
For a task that is not an instance of Schedulable, the result
can only be heap or immortal memory.MemoryArea object representing the
current allocation context.public static void sleep(HighResolutionTime<?> time) throws java.lang.InterruptedException, java.lang.ClassCastException, StaticIllegalArgumentException
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. When
relative, then the calling thread is blocked for the amount of time
given by time, and measured by clock. When
absolute, then the calling thread is blocked until the indicated
value is reached by clock. When the given absolute time
is less than or equal to the current value of clock,
the call to sleep returns immediately.
Calling sleep is permissible when control is in
an AsyncEventHandler. The method causes the handler to
sleep.
This method must not throw IllegalAssignmentError.
It must tolerate time instances that may not be stored
in this.
time - The amount of time to sleep or the point in time at
which to awaken.java.lang.InterruptedException - when the thread is interrupted by
interrupt() or
AsynchronouslyInterruptedException.fire() during
the time between calling this method and returning from it.java.lang.ClassCastException - when the current execution context is
not an instance of Schedulable.StaticIllegalArgumentException - when time is null,
when time is a relative time less than zero, or
when the Chronograph of time is not a
Clock.public static boolean waitForNextRelease()
throws StaticIllegalStateException,
java.lang.ClassCastException
release().) Used by threads that have a reference to
either periodic or aperiodic ReleaseParameters. The first
release starts when this thread is released as a
consequence of the action of one of the start() family of
methods. Each time this method is called it will block until the
next release unless the thread is in a deadline miss condition.
In that case, the operation of waitForNextRelease is
controlled by this thread's scheduler. (See PriorityScheduler.)false when the thread is in a deadline miss
condition or true otherwise. When a deadline miss
condition occurs is defined by its thread's scheduler.StaticIllegalStateException - when
this does not have a reference to a
ReleaseParameters type of either
PeriodicParameters or AperiodicParameters.java.lang.ClassCastException - when the current thread is not an
instance of RealtimeThread.public static boolean waitForNextReleaseInterruptible()
throws java.lang.InterruptedException,
StaticIllegalStateException,
java.lang.ClassCastException
waitForNextRelease() except it can throw an interrupted
exceptionfalse when the thread is in a deadline miss
condition or true otherwise. When a deadline miss
condition occurs is defined by its thread's scheduler.java.lang.InterruptedException - when the thread is interrupted
by interrupt() or
AsynchronouslyInterruptedException.fire() during
the time between calling this method and returning from it and
the ReleaseParameters.isRousable() on its release
parameters returns true.
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
timing behavior of the thread is unspecified until the
state is reset by altering the thread's release
parameters or the thread is no longer in a deadline miss state.
StaticIllegalStateException - when
this does not have a reference to a
ReleaseParameters type of either
PeriodicParameters or AperiodicParameters.java.lang.ClassCastException - when the current thread is not an
instance of RealtimeThread.public boolean subsumes(Schedulable other)
SchedulableSchedulable is
more eligible than other. On multicore systems, this only
gives a partial ordering over all schedulables. Schedulables with
disjoint processor affinity do not subsume one another.subsumes in interface Schedulablesubsumes in interface Subsumable<Schedulable>other - The object to be compared with.true when and only when this instance of
Schedulable is more eligible than other.@Deprecated
public static int getInitialMemoryAreaIndex()
throws StaticIllegalStateException,
java.lang.ClassCastException
Schedulable in the memory area stack. Memory area stacks may
include inherited stacks from parent threads. The initial memory area of
a RealtimeThread or an AsyncBaseEventHandler is the
memory area specified in its constructor. The index of the initial memory
area in the initial memory area stack is a fixed property of a
Schedulable.Schedulable.StaticIllegalStateException - when the memory area stack of the
current Schedulable has changed from its initial
configuration and the memory area at the originally specified
initial memory area index is not the initial memory area, thus the
index is invalid.
This can only happen when the application uses the alternate memory module and the initial memory area is a scoped memory area. The following is an example of an event handler that will throw this exception when its initial memory area is a scoped memory area.
public void handleAsyncEvent()
{
MemoryArea current = RealtimeThread.getCurrentMemoryArea();
if (current instanceof ScopedMemory)
{
MemoryArea parent =
((ScopedMemory) current).getParent();
parent.executeInArea(() ->
{
ScopedMemory scope = new LTMemory(1000);
scope.enter(() ->
{
System.out.println("Initial Memory Area Index = " +
RealtimeThread.getInitialMemoryAreaIndex());
});
});
}
}
java.lang.ClassCastException - when the current execution context is
not an instance of Schedulable.
An exception will be thrown on line 12, where the first opening bracket
is line one, of the handler above.@Deprecated
public static int getMemoryAreaStackDepth()
throws java.lang.ClassCastException
MemoryArea instances
to which the current schedulable has access. For a realtime thread
started with immortal or heap as its explicit initial memory area,
the initial size is one. The current memory area
(getCurrentMemoryArea()) is found at memory area stack index of
getMemoryAreaStackDepth() - 1.MemoryArea instances.java.lang.ClassCastException - when the current execution context is
not an instance of Schedulable.@Deprecated public static MemoryArea getOuterMemoryArea(int index) throws java.lang.ClassCastException, MemoryAccessError
MemoryArea in the memory area stack
at the index given. When the given index does not exist in the
memory area stack, then null is returned. For a thread
started with immortal or heap as its explicit initial memory area, the
index of that area is zero. The current memory area
(getCurrentMemoryArea()) is found at memory area stack index
getMemoryAreaStackDepth() - 1, so
getCurrentMemoryArea() == getOutMemoryArea(getMemoryAreaStackDepth()
- 1).
Note that accessing the stack should have a maximum complexity of
O(n, where n is the stack depth. This means the memory
stack need not be backed by an array.
index - The offset into the memory area stack.MemoryArea at index or null
when the given index does not correspond to a position
in the stack.java.lang.ClassCastException - when the current execution context is
not an instance of Schedulable.MemoryAccessError - when the memory area is allocated in heap
memory and the caller is a schedulable that may not use the heap.@Deprecated public static void sleep(Clock clock, HighResolutionTime<?> time) throws java.lang.InterruptedException, java.lang.ClassCastException, StaticUnsupportedOperationException, StaticIllegalArgumentException
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 associated with time. The
time base is the given Clock associated with time.
The sleep time may be relative or absolute. When relative, then the
calling thread is blocked for the amount of time given by time, and measured by clock. When absolute, then the
calling thread is blocked until the indicated value is reached by
clock. When the given absolute time is less than or equal
to the current value of clock, the call to sleep returns
immediately.
Calling sleep is permissible when control is in
an AsyncEventHandler. The method causes the handler to
sleep.
This method must not throw IllegalAssignmentError.
It must tolerate time instances that may not be stored
in this.
clock - The instance of Clock used as the base. When
clock is null the realtime clock (see
Clock.getRealtimeClock()) is used. When 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.java.lang.InterruptedException - when the thread is interrupted by
interrupt() or
AsynchronouslyInterruptedException.fire() during
the time between calling this method and returning from it.java.lang.ClassCastException - when the current execution context is
not an instance of Schedulable.StaticUnsupportedOperationException - when the
sleep operation is not supported
by clock.StaticIllegalArgumentException - when time is
null, or when time is a
relative time less than zero.@Deprecated
public static boolean waitForNextPeriod()
throws java.lang.ClassCastException,
java.lang.IllegalThreadStateException
waitForNextRelease()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 PriorityScheduler.)false when the thread is in a deadline miss
condition or true otherwise. When a deadline miss
condition occurs is defined by its thread's scheduler.java.lang.IllegalThreadStateException - when this does not
have a reference to a ReleaseParameters type of
PeriodicParameters.java.lang.ClassCastException - when the current thread is not an
instance of RealtimeThread.@Deprecated
public static boolean waitForNextPeriodInterruptible()
throws java.lang.InterruptedException,
java.lang.ClassCastException,
java.lang.IllegalThreadStateException
waitForNextReleaseInterruptible()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 PriorityScheduler)
false, when the thread is in a
deadline miss condition, or true, otherwise.
The time at which a deadline miss condition occurs is
defined by its thread's scheduler.java.lang.InterruptedException - when 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 - when the current thread is not an
instance of RealtimeThread.java.lang.IllegalThreadStateException - when this does not
have a reference to a ReleaseParameters type of
PeriodicParameters.public MemoryArea getMemoryArea()
RealtimeThread.
When not specified through the constructor, the default is a
reference to the current allocation context when this
was constructed.public MemoryParameters getMemoryParameters()
SchedulableMemoryParameters object for this
schedulable.getMemoryParameters in interface SchedulableMemoryParameters object.public ConfigurationParameters getConfigurationParameters()
SchedulableConfigurationParameters
object for this schedulable.getConfigurationParameters in interface SchedulableConfigurationParameters object.public ReleaseParameters<?> getReleaseParameters()
ReleaseParameters object for this
schedulable.getReleaseParameters in interface SchedulableReleaseParameters object.public Scheduler getScheduler()
SchedulableScheduler object for this
schedulable.getScheduler in interface SchedulableScheduler object.public SchedulingParameters getSchedulingParameters()
SchedulableSchedulingParameters object for this
schedulable.getSchedulingParameters in interface SchedulableSchedulingParameters object.public void release()
RealtimeThread. The
action of this release is governed by the scheduler. It may, for
instance, act immediately, or be queued, delayed, or discarded.
This method does not suspend itself and has a runtime complexity
of O(1).StaticIllegalStateException - when this does not
have a reference to a ReleaseParameters type of
AperiodicParameters.public void interrupt()
interrupt in class java.lang.Threadpublic boolean isInterrupted()
isInterrupted in class java.lang.Threadpublic void deschedule()
waitForNextRelease()
or the next time the thread enters waitForNextRelease().public void reschedule()
throws IllegalTaskStateException
waitForNextRelease() to
return. Deadline miss and cost enforcement are re-enabled.
The details of the interaction of this method with
deschedule(), waitForNextRelease() and release()
are dictated by this thread's scheduler.
IllegalTaskStateException - when the configured
Scheduler and SchedulingParameters for this
RealtimeThread are not compatible.public void startPeriodic(PhasingPolicy phasingPolicy) throws LateStartException, IllegalTaskStateException
phasingPolicy - The phasing policy to be applied when the start
time given in the realtime thread's associated
PeriodicParameters is in the past.LateStartException - when the actual start
time is after the assigned start time and the phasing policy
is PhasingPolicy.STRICT_PHASING.IllegalTaskStateException - when the configured Scheduler
and SchedulingParameters for this
RealtimeThread are not compatible or the thread is
does not have periodic parameters with an absolute start time.public void start()
throws StaticIllegalStateException
ScopedMemory.)
It is never legal to start a thread more than once. In
particular, a thread may not be restarted once it has completed
execution.start in class java.lang.ThreadStaticIllegalStateException - when the configured Scheduler
and SchedulingParameters for this
RealtimeThread are not compatible.IllegalTaskStateException - when the affinity of this
RealtimeThread is not compatible with the affinity of the
RealtimeThreadGroup it belongs.java.lang.IllegalThreadStateException - when the thread is already started.public AbsoluteTime getEffectiveStartTime()
getEffectiveStartTime(null).public AbsoluteTime getEffectiveStartTime(AbsoluteTime dest)
dest. When
dest is null, returns the
effective start time in an AbsoluteTime instance
created in the current memory area.public boolean mayUseHeap()
schedulable may use the heap.mayUseHeap in interface Schedulabletrue only when this Schedulable may allocate
on the heap and may enter HeapMemory.public Schedulable setMemoryParameters(MemoryParameters memory)
SchedulableSchedulable.
This change becomes effective at the next allocation; on multiprocessor systems, there may be some delay due to synchronization between processors.
setMemoryParameters in interface Schedulablememory - A MemoryParameters object which will become
the memory parameters associated with
this after the method call. When
null, the default value is governed by
the associated scheduler; a new object is created when
the default value is not null. (See
PriorityScheduler.)thispublic Schedulable setReleaseParameters(ReleaseParameters<?> release)
SchedulableSchedulable.
This change becomes effective under conditions determined by the scheduler controlling the schedulable. For instance, the change may be immediate or it may be delayed until the next release of the schedulable. The different properties of the release parameters may take effect at different times. See the documentation for the scheduler for details.
setReleaseParameters in interface Schedulablerelease - 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. When null, the default value is
governed by the associated scheduler; a new object is
created when the default value is not null.
(See PriorityScheduler.)thispublic Schedulable setScheduler(Scheduler scheduler)
scheduler. If the
Schedulable is running, its associated
SchedulingParameters (if any) must be compatible with
scheduler.
For an instance of RealtimeThread, the Schedulable
is running when start()
has been called on it and RealtimeThread.join() would
block.
setScheduler in interface Schedulablescheduler - A reference to the scheduler that will manage
execution of this schedulable. Null is
not a permissible value.thisStaticIllegalArgumentException - when scheduler
is null, or the schedulable's existing
parameter values are not compatible with
scheduler. Also when this schedulable
may not use the heap and scheduler is located in heap
memory.IllegalAssignmentError - when the schedulable cannot
hold a reference to scheduler or the current
Schedulable is running and its associated
SchedulingParameters are incompatible with
scheduler.StaticSecurityException - when the caller is not permitted to set
the scheduler for this schedulable.IllegalTaskStateException - when scheduler
has scheduling or release parameters that are not compatible
with the new scheduler and this schedulable is running.public Schedulable setScheduler(Scheduler scheduler, SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memoryParameters)
Schedulablescheduler.setScheduler in interface Schedulablescheduler - A reference to the scheduler that will manage the
execution of this schedulable. Null is
not a permissible value.scheduling - A reference to the SchedulingParameters
which will be associated with this. When
null, the default value is governed by
scheduler; a new object is created when the
default value is not null. (See PriorityScheduler.)release - A reference to the ReleaseParameters which
will be associated with this. When
null, the default value is governed by
scheduler; a new object is created when the
default value is not null. (See PriorityScheduler.)memoryParameters - A reference to the MemoryParameters
which will be associated with this. When
null, the default value is governed by
scheduler; a new object is created when the default
value is not null. (See PriorityScheduler.)thispublic Schedulable setSchedulingParameters(SchedulingParameters scheduling)
SchedulableSchedulable.
This change becomes effective under conditions determined by the scheduler controlling the schedulable. For instance, the change may be immediate or it may be delayed until the next release of the schedulable. See the documentation of the scheduler for details.
setSchedulingParameters in interface Schedulablescheduling - A reference to the SchedulingParameters
object. When null, the default value is governed
by the associated scheduler; a new object is created when the
default value is not null. (See
PriorityScheduler.). When the Affinity is not defined
in scheduling, then the affinity that will be used
is the one of the creating Thread. However, this default
affinity will not appear when calling
Schedulable.getSchedulingParameters(), unless explicitly set using
this method.this@Deprecated public boolean addIfFeasible()
this
added to the system. When the resulting system is feasible,
informs the scheduler and cooperating facilities that this
instance of Schedulable should be considered in
feasibility analysis until further notified. When the analysis shows
that the system including this would not be feasible,
this method does not admit this to the feasibility set.
When the object is already included in the feasibility set, does nothing.
true when inclusion of this in the feasibility
set yields a feasible system, and false
otherwise. When true is returned then
this is known to be in the
feasibility set. When false is returned,
this was not added to the
feasibility set, but it may already have been
present.@Deprecated public boolean addToFeasibility()
Schedulable should be considered in
feasibility analysis until further notified.
When the object is already included in the feasibility set, does nothing.
addToFeasibility in interface Schedulabletrue, when the resulting system is feasible.
False, when not.@Deprecated public void deschedulePeriodic()
ReleaseParameters object associated with
this RealtimeThread is an instance of
PeriodicParameters, performs any deschedulePeriodic
actions specified by this thread's scheduler.
When the type of the associated instance of ReleaseParameters
is not PeriodicParameters nothing happens.@Deprecated public ProcessingGroupParameters getProcessingGroupParameters()
ProcessingGroupParameters object
for this schedulable.getProcessingGroupParameters in interface SchedulableProcessingGroupParameters object.@Deprecated public boolean removeFromFeasibility()
Schedulable should not be considered in
feasibility analysis until it is further notified.removeFromFeasibility in interface Schedulabletrue when the removal was successful.
false when the
schedulable cannot be removed from the scheduler's
feasibility set; e.g., the schedulable is not part
of the scheduler's feasibility set.@Deprecated public void schedulePeriodic()
waitForNextPeriod() for a
periodic thread. When deadline miss detection is disabled, enables
it. Typically used when a periodic schedulable 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.
When this RealtimeThread does not have a type of
PeriodicParameters as its ReleaseParameters nothing
happens.
@Deprecated public boolean setIfFeasible(ReleaseParameters<?> release, MemoryParameters memory)
this. When 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. For instance, the change may be immediate or it may be delayed until the next release of the schedulable. See the documentation for the scheduler for details.
This method does not require that the schedulable be in the feasibility set before it is called. When it is not initially a member of the feasibility set it will be added when the resulting system is feasible.
release - The release parameters to use. When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not null).
(See PriorityScheduler.)memory - The memory parameters to use. When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not null).
(See PriorityScheduler.)true, when the resulting system is feasible and the changes
are made. False, when the resulting system is not feasible
and no changes are made.StaticIllegalArgumentException - when the parameter values
are not compatible with the schedulable's scheduler.
Also when this schedulable may not use the heap and any of the
specified parameter objects are located in heap memory.IllegalAssignmentError - when this cannot hold
references to the specified parameter objects, or the
parameter objects cannot hold a reference to this.java.lang.IllegalThreadStateException - when the schedulable's
scheduler prohibits this parameter change at this time due
to the state of the schedulable.Schedulable interface.@Deprecated public boolean setIfFeasible(ReleaseParameters<?> release, MemoryParameters memory, ProcessingGroupParameters group)
this. When 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. For instance, the change may be immediate or it may be delayed until the next release of the schedulable. See the documentation for the scheduler for details.
This method does not require that the schedulable be in the feasibility set before it is called. When it is not initially a member of the feasibility set it will be added when the resulting system is feasible.
release - The release parameters to use. When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not null).
(See PriorityScheduler.)memory - The memory parameters to use. When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not null).
(See PriorityScheduler.)release - The release parameters to use. When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not
null). (See PriorityScheduler.)memory - The memory parameters to use. When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not
null). (See PriorityScheduler.)group - The processing group parameters to use. When
null, the default value is governed by the
associated scheduler (a new object is created when the default
value is not null). (See PriorityScheduler.)true, when the resulting system is feasible and the changes
are made. False, when the resulting system is not feasible
and no changes are made.StaticIllegalArgumentException - when the parameter values
are not compatible with the schedulable's scheduler.
Also when this schedulable may not use the heap and any of the
specified parameter objects are located in heap memory.IllegalAssignmentError - when this cannot hold
references to the specified parameter objects, or the
parameter objects cannot hold a reference to this.java.lang.IllegalThreadStateException - when the schedulable's
scheduler prohibits this parameter change at this time due
to the state of the schedulable.Schedulable interface.@Deprecated public boolean setIfFeasible(ReleaseParameters<?> release, ProcessingGroupParameters group)
this. When 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. For instance, the change may be immediate or it may be delayed until the next release of the schedulable. See the documentation for the scheduler for details.
This method does not require that the schedulable be in the feasibility set before it is called. When it is not initially a member of the feasibility set it will be added when the resulting system is feasible.
release - The release parameters to use. When
null, the default value is governed by the
associated scheduler (a new object is created when the default
value is not null). (See PriorityScheduler.)group - The processing group parameters to use. When
null, the default value is governed by the
associated scheduler (a new object is created when the default
value is not null). (See PriorityScheduler.)true, when the resulting system is feasible and the changes
are made. False, when the resulting system is not feasible
and no changes are made.StaticIllegalArgumentException - when the parameter values
are not compatible with the schedulable's scheduler.
Also when this schedulable may not use the heap and any of the
specified parameter objects are located in heap memory.IllegalAssignmentError - when this cannot hold
references to the specified parameter objects, or the
parameter objects cannot hold a reference to this.java.lang.IllegalThreadStateException - when the schedulable's
scheduler prohibits this parameter change at this time due
to the state of the schedulable.Schedulable interface.@Deprecated public boolean setIfFeasible(SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory)
this. When 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. For instance, the change may be immediate or it may be delayed until the next release of the schedulable. See the documentation for the scheduler for details.
This method does not require that the schedulable be in the feasibility set before it is called. When it is not initially a member of the feasibility set it will be added when the resulting system is feasible.
scheduling - The scheduling parameters to use. When null, the default value is governed by the associated
scheduler (a new object is created when the default value
is not null). (See PriorityScheduler.)release - The release parameters to use. When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not
null). (See PriorityScheduler.)memory - The memory parameters to use. When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not
null). (See PriorityScheduler.)true, when the resulting system is feasible and
the changes are made. False, when the resulting system
is not feasible and no changes are made.StaticIllegalArgumentException - when the parameter values
are not compatible with the schedulable's scheduler.
Also when this schedulable may not use the heap and any
of the specified parameter objects are located in heap
memory.IllegalAssignmentError - when this cannot hold
references to the specified parameter objects, or the
parameter objects cannot hold a reference to this.java.lang.IllegalThreadStateException - when the schedulable's
scheduler prohibits this parameter change at this time due
to the state of the schedulable.@Deprecated public boolean setIfFeasible(SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memory, ProcessingGroupParameters group)
this. When 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. For instance, the change may be immediate or it may be delayed until the next release of the schedulable. See the documentation for the scheduler for details.
This method does not require that the schedulable be in the feasibility set before it is called. When it is not initially a member of the feasibility set it will be added when the resulting system is feasible.
scheduling - The scheduling parameters to use. When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not null).
(See PriorityScheduler.)release - The release parameters to use . When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not null).
(See PriorityScheduler.)memory - The memory parameters to use. When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not null).
(See PriorityScheduler.)group - The processing group parameters to use. When
null, the default value is governed by the associated
scheduler (a new object is created when the default value is not
null). (See PriorityScheduler.)true, when the resulting system is feasible and the changes
are made. False, when the resulting system is not feasible
and no changes are made.StaticIllegalArgumentException - when the parameter values
are not compatible with the schedulable's scheduler.
Also when this schedulable may not use the heap and any of the
specified parameter objects are located in heap memory.IllegalAssignmentError - when this cannot hold
references to the specified parameter objects, or the
parameter objects cannot hold a reference to this.java.lang.IllegalThreadStateException - when the schedulable's
scheduler prohibits this parameter change at this time due
to the state of the schedulable.@Deprecated public boolean setMemoryParametersIfFeasible(MemoryParameters memory)
this. When 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. For instance, the change may be immediate or it may be delayed until the next release of the schedulable. See the documentation for the scheduler for details.
This method does not require that the schedulable be in the feasibility set before it is called. When it is not initially a member of the feasibility set it will be added when the resulting system is feasible.
memory - The memory parameters to use. When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not null).
(See PriorityScheduler.)true, when the resulting system is feasible and the changes
are made. False, when the resulting system is not feasible
and no changes are made.StaticIllegalArgumentException - when the parameter value is
not compatible with the schedulable's scheduler.
Also when this schedulable may not use the heap and the
specified parameter object is located in heap memory.IllegalAssignmentError - when this cannot hold a
reference to the specified parameter object, or the
parameter object cannot hold a reference to this.java.lang.IllegalThreadStateException - when the schedulable's
scheduler prohibits the changing of the memory parameter at
this time due to the state of the schedulable.@Deprecated public void setProcessingGroupParameters(ProcessingGroupParameters group)
ProcessingGroupParameters of this.
This change becomes effective under conditions determined by the scheduler controlling the schedulable. For instance, the change may be immediate or it may be delayed until the next release of the schedulable. See the documentation for the scheduler for details.
setProcessingGroupParameters in interface Schedulablegroup - A ProcessingGroupParameters object which will
take effect as determined by the associated scheduler. When
null, the default value is governed by the
associated scheduler (a new object is created when the default
value is not null). (See PriorityScheduler.)StaticIllegalArgumentException - when group is
not compatible with the scheduler for this schedulable
object. Also when this schedulable may not use the heap and
group is located in heap memory.IllegalAssignmentError - when this object cannot
hold a reference to group or
group cannot hold a reference to
this.java.lang.IllegalThreadStateException - when the schedulable's
scheduler prohibits the changing of the processing group
parameter at this time due to the state of the schedulable
object.@Deprecated public boolean setProcessingGroupParametersIfFeasible(ProcessingGroupParameters group)
this. When 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. For instance, the change may be immediate or it may be delayed until the next release of the schedulable. See the documentation for the scheduler for details.
This method does not require that the schedulable be in the feasibility set before it is called. When it is not initially a member of the feasibility set it will be added when the resulting system is feasible.
group - The processing group parameters to use. When
null, the default value is governed by the
associated scheduler (a new object is created when the default
value is not null). (See PriorityScheduler.)true, when the resulting system is feasible and the changes
are made. False, when the resulting system is not feasible
and no changes are made.StaticIllegalArgumentException - when the parameter value is
not compatible with the schedulable's scheduler.
Also when this schedulable may not use the heap and the
specified parameter object is located in heap memory.IllegalAssignmentError - when this cannot hold a
reference to the specified parameter object, or the
parameter object cannot hold a reference to this.java.lang.IllegalThreadStateException - when the schedulable's
scheduler prohibits the changing of the processing group
parameter at this time due to the state of the schedulable
object.@Deprecated public boolean setReleaseParametersIfFeasible(ReleaseParameters<?> release)
this. When 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. For instance, the change may be immediate or it may be delayed until the next release of the schedulable. See the documentation for the scheduler for details.
This method does not require that the schedulable be in the feasibility set before it is called. When it is not initially a member of the feasibility set it will be added when the resulting system is feasible.
release - The release parameters to use. When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not null).
(See PriorityScheduler.)true, when the resulting system is feasible and the changes
are made. False, when the resulting system is not feasible
and no changes are made.StaticIllegalArgumentException - when the parameter value is
not compatible with the schedulable's scheduler.
Also when this schedulable may not use the heap and the
specified parameter object is located in heap memory.IllegalAssignmentError - when this cannot hold a
reference to the specified parameter object, or the
parameter object cannot hold a reference to this.java.lang.IllegalThreadStateException - when the schedulable's
scheduler prohibits the changing of the release parameter
at this time due to the state of the schedulable.@Deprecated public void setScheduler(Scheduler scheduler, SchedulingParameters scheduling, ReleaseParameters<?> release, MemoryParameters memoryParameters, ProcessingGroupParameters group)
scheduler.scheduler - A reference to the scheduler that will manage the
execution of this schedulable. Null is
not a permissible value.scheduling - A reference to the SchedulingParameters
which will be associated with this. When
null, the default value is governed by
scheduler; a new object is created when the
default value is not null. See PriorityScheduler.release - A reference to the ReleaseParameters which
will be associated with this. When
null, the default value is governed by
scheduler; a new object is created when the
default value is not null. See PriorityScheduler.memoryParameters - A reference to the MemoryParameters
which will be associated with this. When
null, the default value is governed by
scheduler; a new object is created when the default
value is not null. (See PriorityScheduler.)group - A reference to the ProcessingGroupParameters
which will be associated with this. When
null, the default value is governed by
scheduler; a new object is created when the
default value is not null. (See
PriorityScheduler.)StaticIllegalArgumentException - when scheduler
is null or the parameter values are not
compatible with scheduler. Also thrown when
this schedulable may not use the heap and
scheduler, scheduling
release, memoryParameters, or
group is located in heap memory.IllegalAssignmentError - when this object cannot
hold references to all the parameter objects or the
parameters cannot hold references to this.java.lang.IllegalThreadStateException - when scheduler
prohibits the changing of the scheduler or a parameter at
this time due to the state of the schedulable.StaticSecurityException - when the caller is not permitted to set
the scheduler for this schedulable.@Deprecated public boolean setSchedulingParametersIfFeasible(SchedulingParameters scheduling)
this. When 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. For instance, the change may be immediate or it may be delayed until the next release of the schedulable. See the documentation for the scheduler for details.
This method does not require that the schedulable be in the feasibility set before it is called. When it is not initially a member of the feasibility set it will be added when the resulting system is feasible.
scheduling - The scheduling parameters to use. When null,
the default value is governed by the associated scheduler
(a new object is created when the default value is not null).
(See PriorityScheduler.)true, when the resulting system is feasible and
the changes are made. False, when the resulting system
is not feasible and no changes are made.StaticIllegalArgumentException - when the parameter value is
not compatible with the schedulable's scheduler.
Also when this schedulable may not use the heap and the
specified parameter object is located in heap memory.IllegalAssignmentError - when this cannot hold a
reference to the specified parameter object, or the
parameter object cannot hold a reference to this.java.lang.IllegalThreadStateException - when the schedulable's
scheduler prohibits the changing of the scheduling
parameter at this time due to the state of the schedulable
object.