|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--javax.realtime.MemoryArea
MemoryArea is the abstract base class of all classes
dealing with the representations of allocatable memory areas,
including the immortal memory area, physical memory and scoped memory
areas.
| Constructor Summary | |
protected |
MemoryArea(long sizeInBytes)
|
protected |
MemoryArea(long sizeInBytes,
java.lang.Runnable logic)
|
protected |
MemoryArea(SizeEstimator size)
|
protected |
MemoryArea(SizeEstimator size,
java.lang.Runnable logic)
|
| Method Summary | |
void |
enter()
Associate this memory area to the current real-time thread for the duration of the execution of the run() method
of the java.lang.Runnable passed at construction time. |
void |
enter(java.lang.Runnable logic)
Associate this memory area to the current real-time thread for the duration of the execution of the run() method
of the given java.lang.Runnable. |
void |
executeInArea(java.lang.Runnable logic)
Execute the run method from the logic parameter using this
memory area as the current allocation context. |
static MemoryArea |
getMemoryArea(java.lang.Object object)
Returns the MemoryArea in which the given
object is located. |
long |
memoryConsumed()
An exact count, in bytes, of the all of the memory currently used by the system for the allocated objects. |
long |
memoryRemaining()
An approximation to the total amount of memory currently available for future allocated objects, measured in bytes. |
java.lang.Object |
newArray(java.lang.Class type,
int number)
Allocate an array of T in this memory area. |
java.lang.Object |
newInstance(java.lang.Class type)
Allocate an object in this memory area. |
java.lang.Object |
newInstance(java.lang.reflect.Constructor c,
java.lang.Object[] args)
Allocate an object in this memory area. |
long |
size()
Query the size of the memory area. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
protected MemoryArea(long sizeInBytes)
sizeInBytes - The size of MemoryArea to allocate,
in bytes.protected MemoryArea(SizeEstimator size)
size - A SizeEstimator object which indicates the
amount of memory required by this MemoryArea.
protected MemoryArea(long sizeInBytes,
java.lang.Runnable logic)
sizeInBytes - The size of MemoryArea to allocate,
in bytes.logic - The run() method of this object will be
called whenever enter() is called.
protected MemoryArea(SizeEstimator size,
java.lang.Runnable logic)
size - A SizeEstimator object which indicates the
amount of memory required by this MemoryArea.logic - The run() method of this object will be
called whenever enter() is called.| Method Detail |
public void enter()
throws ScopedCycleException
run() method
of the java.lang.Runnable passed at construction time.
During this bound period of execution, all objects are allocated
from the memory area until another one takes effect, or the
enter() method is exited. A runtime exception is thrown
if this method is called from thread other than a
RealtimeThread or NoHeapRealtimeThread.java.lang.IllegalArgumentException - Thrown if no Runnable
was passed in the constructor.ScopedCycleException - If entering this ScopedMemory would
violate the single parent rule.
public void enter(java.lang.Runnable logic)
throws ScopedCycleException
run() method
of the given java.lang.Runnable. During this bound
period of execution, all objects are allocated from the memory
area until another one takes effect, or the enter()
method is exited. A runtime exception is thrown if this method
is called from thread other than a RealtimeThread or
NoHeapRealtimeThread.logic - The Runnable object whose run() method
should be invoked.ScopedCycleException - If entering this ScopedMemory would
violate the single parent rule.public static MemoryArea getMemoryArea(java.lang.Object object)
MemoryArea in which the given
object is located.MemoryArea of the object.public long memoryConsumed()
public long memoryRemaining()
public java.lang.Object newArray(java.lang.Class type,
int number)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
type - The class of the elements of the new array.number - The number of elements in the new array.java.lang.IllegalAccessException - The class or initializer is inaccessible.java.lang.InstantiationException - The array cannot be instantiated.OutOfMemoryError - Space in the memory area is exhausted.
public java.lang.Object newInstance(java.lang.Class type)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
type - The class of which to create a new instance.type.java.lang.IllegalAccessException - The class or initializer is inaccessible.java.lang.InstantiationException - The specified class object could not be
instantiated. Possible causes are: it is an interface, it is abstract,
it is an array, or an exception was thrown by the constructor.OutOfMemoryError - Space in the memory area is exhausted.
public java.lang.Object newInstance(java.lang.reflect.Constructor c,
java.lang.Object[] args)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException
type - The class of which to create a new instance.type.java.lang.IllegalAccessException - The class or initializer is inaccessible.java.lang.InstantiationException - The specified class object could not be
instantiated. Possible causes are: it is an interface, it is abstract,
it is an array, or an exception was thrown by the constructor.OutOfMemoryError - Space in the memory area is exhausted.public long size()
public void executeInArea(java.lang.Runnable logic)
throws InaccessibleAreaException
logic parameter using this
memory area as the current allocation context. If the memory area is a
scoped memory type, this method behaves as if it had moved the
allocation context up the scope stack to the occurrence of the memory area.
If the memory area is heap or immortal memory, this method behaves as if the
run method were running in that memory type with an empty scope stack.logic - The runnable object whose run() method should
be executed.IllegalStateException - A non-realtime thread attempted to enter the
memory area.InaccessibleAreaException - The memory area is not in the thread's
scope stack.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||