|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | 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.
Field Summary | |
(package private) boolean |
constant
Indicates whether this memoryArea refers to a constant or not. |
(package private) boolean |
heap
Indicates whether this is a HeapMemory. |
protected int |
id
Every MemoryArea has a unique ID. |
protected java.lang.Runnable |
logic
The run() method of this object is called whenever enter() is called. |
protected long |
memoryConsumed
The size of the consumed memory |
(package private) static java.lang.Class[] |
nullClassArr
|
protected boolean |
nullMem
Indicates whether this is a NullMemoryArea. |
(package private) static java.lang.Object[] |
nullObjArr
|
private static int |
num
This is used to create the unique ID. |
(package private) boolean |
scoped
Indicates whether this is a ScopedMemory. |
(package private) javax.realtime.MemoryArea |
shadow
The shadow of this . |
protected long |
size
The size of this MemoryArea. |
Constructor Summary | |
protected |
MemoryArea(long sizeInBytes)
Create an instance of MemoryArea . |
protected |
MemoryArea(long minimum,
long maximum)
|
protected |
MemoryArea(long sizeInBytes,
java.lang.Runnable logic)
Create an instance of MemoryArea . |
protected |
MemoryArea(javax.realtime.SizeEstimator size)
Create an instance of MemoryArea . |
protected |
MemoryArea(javax.realtime.SizeEstimator size,
java.lang.Runnable logic)
Create an instance of MemoryArea . |
Method Summary | |
void |
bless(java.lang.Object obj)
|
void |
checkAccess(java.lang.Object obj)
Check to see if this object can be accessed from this MemoryArea |
void |
checkNewInstance(javax.realtime.MemoryArea mem)
Check access restrictions for a newInstance |
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
java.lang.Runnable passed at construction time. |
protected void |
enterMemBlock(javax.realtime.RealtimeThread rt,
javax.realtime.MemAreaStack mas)
|
void |
executeInArea(java.lang.Runnable logic)
Execute the run() method from the logic parameter
using this memory area as the current allocation context. |
protected void |
exitMemBlock(javax.realtime.RealtimeThread rt,
javax.realtime.MemAreaStack mas)
|
static javax.realtime.MemoryArea |
getMemoryArea(java.lang.Object object)
Gets the MemoryArea in which the given object is located. |
javax.realtime.MemoryArea |
getOuterScope()
Get the outerScope of this MemoryArea, for non-ScopedMemory's, this defaults to null. |
protected abstract void |
initNative(long sizeInBytes)
|
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 the given type in this memory area. |
java.lang.Object |
newArray(java.lang.Class type,
int[] dimensions)
Create a new array, allocated out of this MemoryArea. |
protected java.lang.Object |
newArray(javax.realtime.RealtimeThread rt,
java.lang.Class type,
int number)
|
protected java.lang.Object |
newArray(javax.realtime.RealtimeThread rt,
java.lang.Class type,
int[] dimensions)
|
java.lang.Object |
newInstance(java.lang.Class type)
Allocate an object in this memory area. |
java.lang.Object |
newInstance(java.lang.Class type,
java.lang.Class[] parameterTypes,
java.lang.Object[] parameters)
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. |
protected java.lang.Object |
newInstance(javax.realtime.RealtimeThread rt,
java.lang.reflect.Constructor constructor,
java.lang.Object[] parameters)
|
protected void |
postSetup()
|
protected void |
preSetup()
|
protected void |
registerFinal()
|
protected javax.realtime.MemoryArea |
shadow()
|
long |
size()
Query the size of the memory area. |
(package private) static void |
startMem(javax.realtime.MemoryArea mem)
Explicitly unsafe way to get by without polluting the previous scope with a Runnable |
(package private) static void |
stopMem()
|
protected void |
throwIllegalAssignmentError(java.lang.Object obj,
javax.realtime.MemoryArea ma)
|
java.lang.String |
toString()
Output a helpful string describing this MemoryArea. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected long size
protected long memoryConsumed
boolean scoped
boolean heap
protected boolean nullMem
protected int id
protected java.lang.Runnable logic
private static int num
boolean constant
javax.realtime.MemoryArea shadow
this
.
static java.lang.Class[] nullClassArr
static java.lang.Object[] nullObjArr
Constructor Detail |
protected MemoryArea(long sizeInBytes)
MemoryArea
.
sizeInBytes
- The size of MemoryArea
to allocate, in bytes.protected MemoryArea(long sizeInBytes, java.lang.Runnable logic)
MemoryArea
.
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(javax.realtime.SizeEstimator size)
MemoryArea
.
size
- A SizeEstimator
object which indicates the amount
of memory required by this MemoryArea
.protected MemoryArea(javax.realtime.SizeEstimator size, java.lang.Runnable logic)
MemoryArea
.
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.protected MemoryArea(long minimum, long maximum)
Method Detail |
protected abstract void initNative(long sizeInBytes)
protected void preSetup()
protected void postSetup()
public void enter()
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
NoHeapRealtimeThrea
.
java.lang.IllegalArgumentException
- Thrown if no Runnable
was passed in the constructor.public void enter(java.lang.Runnable logic)
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
NoHeapRealtimeThrea
.
logic
- The Runnable
object whose run()
method should be invoked.public void executeInArea(java.lang.Runnable logic) throws InaccessibleAreaException
run()
method from the 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.
java.lang.IllegalStateException
- A non-realtime thread attempted to enter the
memory area.
InaccessibleAreaException
- The memory area is not in the thread's
scope stack.public static javax.realtime.MemoryArea getMemoryArea(java.lang.Object object)
MemoryArea
in which the given object is located.
MemoryArea
of the object.public long memoryConsumed()
public long memoryRemaining()
protected java.lang.Object newArray(javax.realtime.RealtimeThread rt, java.lang.Class type, int number)
protected java.lang.Object newArray(javax.realtime.RealtimeThread rt, java.lang.Class type, int[] dimensions)
public java.lang.Object newArray(java.lang.Class type, int number) throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.OutOfMemoryError
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.
java.lang.OutOfMemoryError
- Space in the memory area is exhaused.public java.lang.Object newInstance(java.lang.Class type) throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.OutOfMemoryError
type
- The class of which to create a new instance.
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.
java.lang.OutOfMemoryError
- Space in the memory area is exhaused.public java.lang.Object newInstance(java.lang.Class type, java.lang.Class[] parameterTypes, java.lang.Object[] parameters) throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.OutOfMemoryError
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.OutOfMemoryError
public java.lang.Object newInstance(java.lang.reflect.Constructor c, java.lang.Object[] args) throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.OutOfMemoryError
java.lang.IllegalAccessException
- The class or initializer is
inaccessible.
java.lang.InstantiationException
- The specified class object
could not be instantianted.
Possible causes are: it is an
interface, it is abstract, it
is an array, or an exception
was thrown by the constructor.
java.lang.OutOfMemoryError
- Space in the memory area is exhaused.public long size()
protected java.lang.Object newInstance(javax.realtime.RealtimeThread rt, java.lang.reflect.Constructor constructor, java.lang.Object[] parameters) throws java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
static void startMem(javax.realtime.MemoryArea mem)
static void stopMem()
protected void enterMemBlock(javax.realtime.RealtimeThread rt, javax.realtime.MemAreaStack mas)
protected void exitMemBlock(javax.realtime.RealtimeThread rt, javax.realtime.MemAreaStack mas)
protected void throwIllegalAssignmentError(java.lang.Object obj, javax.realtime.MemoryArea ma) throws IllegalAssignmentError
IllegalAssignmentError
protected javax.realtime.MemoryArea shadow()
protected void registerFinal()
public void bless(java.lang.Object obj)
public java.lang.Object newArray(java.lang.Class type, int[] dimensions) throws java.lang.IllegalAccessException, java.lang.OutOfMemoryError
java.lang.IllegalAccessException
java.lang.OutOfMemoryError
public void checkAccess(java.lang.Object obj)
public void checkNewInstance(javax.realtime.MemoryArea mem)
public javax.realtime.MemoryArea getOuterScope()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |