java.lang.Objectjavax.realtime.MemoryArea
javax.realtime.HeapMemory
public final class HeapMemory
The HeapMemory
class is a singleton object that allows
logic with a non-heap allocation context to allocate objects in the Java heap.
Method Summary | |
---|---|
void |
executeInArea(java.lang.Runnable logic)
Execute the run method from the logic parameter using heap
as the current allocation context. |
static HeapMemory |
instance()
Returns a reference to the singleton instance of HeapMemory representing
the Java heap. |
Methods inherited from class javax.realtime.MemoryArea |
---|
enter, enter, getMemoryArea, memoryConsumed, memoryRemaining, newArray, newInstance, newInstance, size |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static HeapMemory instance()
HeapMemory
representing
the Java heap.
The singleton instance of this class shall be allocated in the
ImmortalMemory
area.
HeapMemory
object.public void executeInArea(java.lang.Runnable logic)
logic
parameter using heap
as the current allocation context.
For a schedulable object, this saves the current scope
stack and replaces it with one consisting only of the HeapMemory
instance;
restoring the original scope stack upon completion.
executeInArea
in class MemoryArea
logic
- The runnable object whose run()
method should
be executed.
java.lang.IllegalArgumentException
- Thrown if logic
is null.