javax.realtime
Class NoHeapRealtimeThread
java.lang.Object
|
+--java.lang.Thread
|
+--javax.realtime.RealtimeThread
|
+--javax.realtime.NoHeapRealtimeThread
- All Implemented Interfaces:
- java.lang.Runnable, Schedulable
- public class NoHeapRealtimeThread
- extends RealtimeThread
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 nor
is it even allowed to manipulate any reference to any object in the heap.
For example, if a and b are objects in immortal memory, b.p is reference to an object
on the heap, and a.p is type compatible with b.p, then
a NoHeapRealtimeThread is not allowed to execute anything like the following:
a.p = b.p;
b.p = null;
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.
Parameters for constructors may be null. In such cases the default
value will be the default value set for the particular type by the associated
instance of Scheduler.
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
|
Method Summary |
void |
start()
Checks if the NoHeapRealtimeThread is startable and starts it
if it is. |
| Methods inherited from class javax.realtime.RealtimeThread |
addIfFeasible, addToFeasibility, currentRealtimeThread, deschedulePeriodic, getCurrentMemoryArea, getInitialMemoryAreaIndex, getMemoryAreaStackDepth, getMemoryParameters, getOuterMemoryArea, getProcessingGroupParameters, getReleaseParameters, getScheduler, getSchedulingParameters, interrupt, removeFromFeasibility, schedulePeriodic, setIfFeasible, setIfFeasible, setIfFeasible, setMemoryParameters, setMemoryParametersIfFeasible, setProcessingGroupParameters, setProcessingGroupParametersIfFeasible, setReleaseParameters, setReleaseParametersIfFeasible, setScheduler, setScheduler, setSchedulingParameters, setSchedulingParametersIfFeasible, sleep, sleep, waitForNextPeriod |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setName, setPriority, 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 |
NoHeapRealtimeThread
public NoHeapRealtimeThread(SchedulingParameters sp,
MemoryArea ma)
throws java.lang.IllegalArgumentException
- Create a
NoHeapRealtimeThread.
- Parameters:
scheduling - A SchedulingParameters object that will
be associated with this. A null value means this will not
have an associated SchedulingParameters object.area - A MemoryArea object. Must be a ScopedMemory or ImmortalMemory type.
A null value causes an IllegalArgumentException to be thrown.
NoHeapRealtimeThread
public NoHeapRealtimeThread(SchedulingParameters sp,
ReleaseParameters rp,
MemoryArea ma)
throws java.lang.IllegalArgumentException
- Create a
NoHeapRealtimeThread.
- Parameters:
scheduling - A SchedulingParameters object that will
be associated with this. A null value means this will not
have an associated SchedulingParameters object.release - A ReleaseParameters object that will be associated
with this. A null value means this will not
have an associated ReleaseParameters object.area - A MemoryArea object. Must be a ScopedMemory or ImmortalMemory type.
A null value causes an IllegalArgumentException to be thrown.
NoHeapRealtimeThread
public NoHeapRealtimeThread(SchedulingParameters sp,
ReleaseParameters rp,
MemoryParameters mp,
MemoryArea ma,
ProcessingGroupParameters group,
java.lang.Runnable logic)
throws java.lang.IllegalArgumentException
- Create a
NoHeapRealtimeThread.
- Parameters:
scheduling - A SchedulingParameters object that will
be associated with this. A null value means this will not
have an associated SchedulingParameters object.release - A ReleaseParameters object that will
be associated with this. A null value means this will not
have an associated ReleaseParameters object.memory - A MemoryParameters object that will be associated
with this. A null value means this will not
have a MemoryParameters object.area - A MemoryArea object. Must be a ScopedMemory
or ImmortalMemory type.
A null value causes an IllegalArgumentException to be thrown.group - A ProcessingGroupParameters object
that will be associated with this. A null value means
this will not have an associated ProcessingGroupParameters object.logic - A Runnable whose run() method will be executed for this.
start
public void start()
- Checks if the NoHeapRealtimeThread is startable and starts it
if it is. Checks that the parameters associated with this NHRT
object are not allocated in heap. Also checks if
this object is allocated in heap. If any of them
are allocated, start() throws a MemoryAccessError
- Overrides:
start in class RealtimeThread
- Throws:
MemoryAccessError - If any of the parameters or
this is allocated on heap.