java.lang.Objectjava.lang.Thread
javax.realtime.RealtimeThread
javax.realtime.NoHeapRealtimeThread
public class NoHeapRealtimeThread
A NoHeapRealtimeThread is a specialized form of RealtimeThread.
Because an instance of NoHeapRealtimeThread may immediately preempt any
implemented garbage collector, logic contained in its run()
is never allowed to allocate or reference any object allocated in the heap.
At the byte-code level,
it is illegal for a reference to an object allocated in heap
to appear on a no-heap real-time thread's operand stack.
Thus, it is always safe for a NoHeapRealtimeThread to interrupt the garbage
collector at any time, without waiting for the end of the garbage collection
cycle or a defined preemption point. Due to these restrictions,
a NoHeapRealtimeThread object must be placed in a memory area such that
thread logic may unexceptionally access instance variables and such that
Java methods on Thread (e.g., enumerate and join) complete normally
except where execution would cause access violations.
The constructors of NoHeapRealtimeThread require a reference to ScopedMemory
or ImmortalMemory.
When the thread is started, all execution occurs in the scope of the given memory area. Thus, all memory allocation performed with the new operator is taken from this given area.
| 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 | |
|---|---|
NoHeapRealtimeThread(SchedulingParameters scheduling,
MemoryArea area)
Create a NoHeapRealtimeThread. |
|
NoHeapRealtimeThread(SchedulingParameters scheduling,
ReleaseParameters release,
MemoryArea area)
Create a no-heap real-time thread with the given characteristics. |
|
NoHeapRealtimeThread(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 Runnable. |
|
| Method Summary | |
|---|---|
void |
start()
Checks if the NoHeapRealtimeThread is startable and starts it
if it is. |
| 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 |
|---|
public NoHeapRealtimeThread(SchedulingParameters scheduling,
MemoryArea area)
NoHeapRealtimeThread.
This constructor is equivalent to
NoHeapRealtimeThread(scheduling, null, null, area, null, null).
java.lang.IllegalArgumentException - Thrown if the parameters
are not compatible with the associated scheduler, if area
is null, if area is heap memory, if area or
scheduling is allocated in
heap memory, or if this is in heap memory.
IllegalAssignmentError - Thrown if the new NoHeapRealtimeThread instance
cannot hold a reference to scheduling or area, or if
scheduling cannot hold a reference to the new NoHeapRealtimeThread.
public NoHeapRealtimeThread(SchedulingParameters scheduling,
ReleaseParameters release,
MemoryArea area)
NoHeapRealtimeThread(scheduling, release, null, area, null, null).
java.lang.IllegalArgumentException - Thrown if the parameters
are not compatible with the associated scheduler, if area
is null, if area is heap memory, if area, release or
scheduling is allocated in
heap memory, or if this is in heap memory.
IllegalAssignmentError - Thrown if the new NoHeapRealtimeThread
instance
cannot hold a reference to non-null values of scheduling,
release and area, or if
scheduling and release cannot hold a reference to the
new NoHeapRealtimeThread.
public NoHeapRealtimeThread(SchedulingParameters scheduling,
ReleaseParameters release,
MemoryParameters memory,
MemoryArea area,
ProcessingGroupParameters group,
java.lang.Runnable logic)
Runnable.
The thread group of the new thread is (effectively) null.
The newly-created no-heap real-time 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). If scheduling is null, the default
is a copy of
the creator's scheduling parameters created in the same memory area
as the new NoHeapRealtimeThread.release - The ReleaseParameters associated with this
(and possibly other instances of
Schedulable). If release is null the it
defaults to the a copy of the creator's release parameters
created in the same memory area
as the new NoHeapRealtimeThread.memory - The MemoryParameters associated with this (and possibly other instances of
Schedulable). If memory is null, the new
NoHeapRealtimeThread will have a null value for its
memory parameters, and the amount or rate of memory allocation is unrestricted.area - The MemoryArea associated with this.
If area is null, an IllegalArgumentException is
thrown.group - The ProcessingGroupParameters associated with this
(and possibly other instances of Schedulable).
If null, the new NoHeapRealtimeThread will not be
associated with any processing group.logic - The Runnable object whose run() method
will serve as the logic for the new NoHeapRealtimeThread.
If logic is null, the run() method in the
new object will serve as its logic.
java.lang.IllegalArgumentException - Thrown if the parameters
are not compatible with the associated scheduler, if area
is null, if area is heap memory, if area, scheduling
release, memory or group is allocated in
heap memory, if this is in heap memory, or if logic is in
heap memory.
IllegalAssignmentError - Thrown if the new NoHeapRealtimeThread
instance
cannot hold references to non-null values of the scheduling
release, memory and group, or if
those parameters cannot hold a reference to the
new NoHeapRealtimeThread.
Also thrown if area or logic cannot
be stored in the new RealtimeThread object| Method Detail |
|---|
public void start()
NoHeapRealtimeThread is startable and starts it
if it is.
start in class RealtimeThread