javax.realtime
Class HeapMemory

java.lang.Object
  extended by javax.realtime.MemoryArea
      extended by javax.realtime.HeapMemory

public final class HeapMemory
extends MemoryArea

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

instance

public static HeapMemory instance()
Returns a reference to the singleton instance of HeapMemory representing the Java heap. The singleton instance of this class shall be allocated in the ImmortalMemory area.

Returns:
The singleton HeapMemory object.

executeInArea

public void executeInArea(java.lang.Runnable logic)
Execute the run method from the 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.

Overrides:
executeInArea in class MemoryArea
Parameters:
logic - The runnable object whose run() method should be executed.
Throws:
java.lang.IllegalArgumentException - Thrown if logic is null.