|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.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.
Field Summary | |
protected Runnable |
logic
|
protected MemoryArea |
parent
|
protected long |
sizeInBytes
|
Constructor Summary | |
protected |
MemoryArea()
|
protected |
MemoryArea(long size)
Creates a new MemoryArea instance. |
protected |
MemoryArea(long size,
Runnable logic)
Creates a new MemoryArea instance. |
protected |
MemoryArea(SizeEstimator size)
Creates a new MemoryArea instance. |
protected |
MemoryArea(SizeEstimator size,
Runnable logic)
Creates a new MemoryArea instance. |
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 Runnable passed at construction time. |
void |
enter(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 Runnable . |
void |
executeInArea(Runnable logic)
Execute the run method from the logic parameter using this memory area as the current allocation context. |
protected void |
finalize()
|
static MemoryArea |
getMemoryArea(Object object)
Returns the MemoryArea in which the given object is located. |
protected void |
guardedRun(Runnable logic)
Run the given logic and, if it exits exceptionally, check to ensure that the thrown exception is valid in the parent scope. |
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. |
Object |
newArray(Class type,
int number)
Allocate an array of T in this memory area. |
Object |
newInstance(Class type)
Allocate an object in this memory area. |
Object |
newInstance(Constructor ctor,
Object[] args)
Allocates an object in this memory area. |
long |
size()
Query the size of the memory area. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected long sizeInBytes
protected Runnable logic
protected MemoryArea parent
Constructor Detail |
protected MemoryArea()
protected MemoryArea(long size)
MemoryArea
instance.
size
- the size of MemoryArea
to allocate, in
bytes.
IllegalArgumentException
- if size
is less
than zero
OutOfMemoryError
- if there isn't enough storage
available for the backing memoryprotected MemoryArea(long size, Runnable logic)
MemoryArea
instance.
size
- the size of MemoryArea
to allocate, in
bytes.logic
- The run()
method of this
object will be called whenever enter()
is called.
IllegalArgumentException
- if size
is less
than zero
IllegalAssignmentError
- if storing logic
in
this
violates referencing rules
OutOfMemoryError
- if there isn't enough storage
available for the backing memoryprotected MemoryArea(SizeEstimator size)
MemoryArea
instance.
size
- A SizeEstimator
object which indicates the amount
of memory required by this MemoryArea
.
IllegalArgumentException
- if size
is
null
OutOfMemoryError
- if there isn't enough storage
available for the backing memoryprotected MemoryArea(SizeEstimator size, Runnable logic)
MemoryArea
instance.
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.
IllegalArgumentException
- if size
is
null
IllegalAssignmentError
- if storing logic
in
this
violates referencing rules
OutOfMemoryError
- if there isn't enough storage
available for the backing memoryMethod Detail |
public void enter()
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 this enter()
method
is exited. A runtime exception is thrown if this method is
called from thread other than a RealtimeThread
or
NoHeapRealtimeThread
.
ScopedCycleException
- If entering this ScopedMemory
would violate the single parent rule.public void enter(Runnable logic)
run()
method of the given Runnable
. During this bound
period of execution, all objects are allocated from the memory
area until another one takes effect, or this 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.protected final void guardedRun(Runnable logic)
ThrowBoundaryError
instead.
logic
- The Runnable object whose run() method should be
invoked and checked for exceptional exit.public void executeInArea(Runnable logic) throws InaccessibleAreaException
logic
- The runnable object whose run()
method should be executed.
InaccessibleAreaException
- The memory area is not in the
thread s scope stack.public static MemoryArea getMemoryArea(Object object)
object
- the object for which the associated memory area
will be provided.
public long memoryConsumed()
public long memoryRemaining()
public Object newArray(Class type, int number)
type
- The class of the elements of the new array.number
- The number of elements in the new array.
IllegalAccessException
- The class or initializer is inaccessible.
InstantiationException
- The array cannot be
instantiated.public Object newInstance(Class type) throws InstantiationException, IllegalAccessException
type
- The class of which to create a new instance.
IllegalAccessException
- The class or initializer is
inaccessible.
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.public Object newInstance(Constructor ctor, Object[] args) throws IllegalAccessException, InstantiationException
ctor
- the constructor used to create the new instance.args
- the argument to be passed to the constructor.
IllegalAccessException
- The class or initializer is
inaccessible.
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.public long size()
protected void finalize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |