|
Jamaica 6.4 release 1
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.realtime.MemoryArea
public abstract class MemoryArea
Jamaica Real-Time Specification for Java class MemoryArea.
MemoryArea provides the abstract base class for all allocation environments.
In JamaicaVM, application code is not permitted to create instances of user-defined direct subclasses of MemoryArea.
| Field Summary | |
|---|---|
protected static Object |
memoryAreaHeapLock
Lock to protect alloc() and free() from concurrent execution. |
| Constructor Summary | |
|---|---|
protected |
MemoryArea(long sizeInBytes)
Constructor for a memory area of given size. |
protected |
MemoryArea(long sizeInBytes,
Runnable logic)
Constructor for a memory area that of given size in bytes and sets a logic. |
protected |
MemoryArea(SizeEstimator size)
Constructor for a memory area that gets its size from a SizeEstimator. |
protected |
MemoryArea(SizeEstimator size,
Runnable logic)
Constructor for a memory area that of given size from a SizeEstimator and sets a logic. |
| Method Summary | |
|---|---|
protected void |
clearMemory()
|
protected void |
createStackedMemory()
Create a new child StackedMemory for this memory area. |
void |
enter()
enter enters this memory area and executes the logic that was passed to this memory area's constructor. |
void |
enter(Runnable logic)
enter enters this memory area and executes the given logic. |
void |
executeInArea(Runnable logic)
executeInArea executes a code sequence given as logic in this memory area. |
protected void |
freeStacked()
frees a StackedMemory child previously created with createStackedMemory() |
static MemoryArea |
getMemoryArea(Object object)
getMemoryArea returns the memory area a given object was allocated in. |
long |
memoryConsumed()
memoryConsumed returns the number of bytes of memory of this memory area that have been consumed. |
protected boolean |
memoryNeedsToBeCleared()
|
protected boolean |
memoryNeedsToBeFreed()
|
long |
memoryRemaining()
memoryRemaining returns the number of available bytes left in this memory area. |
Object |
newArray(Class<?> type,
int number)
Allocate a new array with number elements in this memory area. |
Object |
newInstance(Class<?> type)
allocate a new instance of class type in this memory area. |
Object |
newInstance(Constructor<?> c,
Object[] args)
newInstance allocates a new instance using the given constructor and passing arguments to this constructor. |
long |
size()
size returns the size of this memory area in bytes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static Object memoryAreaHeapLock
| Constructor Detail |
|---|
protected MemoryArea(long sizeInBytes)
sizeInBytes - size of the area in bytes.
IllegalArgumentException - if sizeInBytes < 0 or this is
called by a user-defined subclass that does not know about the
memory area implementation details.
OutOfMemoryError - if there is not sufficient memory
available for the new MemoryArea.protected MemoryArea(SizeEstimator size)
size - the requested size.
IllegalArgumentException - if size is null or this is
called by a user-defined subclass that does not know about the
memory area implementation details.
OutOfMemoryError - if there is not sufficient memory
available for the new MemoryArea.
protected MemoryArea(long sizeInBytes,
Runnable logic)
sizeInBytes - size of the area in bytes.logic - the logic to be associated with this memory
area. May be null not to set a default logic.
IllegalArgumentException - if sizeInBytes < 0 or this is
called by a user-defined subclass that does not know about the
memory area implementation details.
OutOfMemoryError - if there is not sufficient memory
available for the new MemoryArea.
protected MemoryArea(SizeEstimator size,
Runnable logic)
size - size of the area.logic - the logic to be associated with this memory area.
IllegalArgumentException - if size is null or this is
called by a user-defined subclass that does not know about the
memory area implementation details.
OutOfMemoryError - if there is not sufficient memory
available for the new MemoryArea.| Method Detail |
|---|
protected void createStackedMemory()
protected void freeStacked()
createStackedMemory()
protected boolean memoryNeedsToBeFreed()
protected boolean memoryNeedsToBeCleared()
protected void clearMemory()
public void enter()
IllegalArgumentException - if no logic was provided to the
constructor or the logic that was provided was null.public void enter(Runnable logic)
logic - the code to be executed in this memory area.
IllegalArgumentException - if logic is null.public static MemoryArea getMemoryArea(Object object)
object - the object, must not be null.
public long memoryConsumed()
public long memoryRemaining()
public Object newArray(Class<?> type,
int number)
throws IllegalArgumentException,
OutOfMemoryError,
InaccessibleAreaException
type - the array typenumber - the number of elements of the array.
IllegalArgumentException - iff number is negative, type is
null or type is Void.TYPE.
throws - OutOfMemoryError iff the space in this memory area is exhausted
InaccessibleAreaException - iff this memory area is not
accessible, i.e. not on the current memory area stack.
OutOfMemoryError
public Object newInstance(Class<?> type)
throws IllegalAccessException,
InstantiationException
type - the type of the new object that is to be allocated.
IllegalAccessException - thrown if class or constructor is
inaccessible.
IllegalArgumentException - iff type is null.
InstantiationException - if object could not be
instantiated (due to type being abstract or an interface or the
constructor caused an exception)
OutOfMemoryError - iff the space in this memory area is exhausted
ExceptionInInitializerError - iff initialization of class
type caused an exception.
InaccessibleAreaException - iff this memory area is not
accessible, i.e. not on the memory area stack.
public Object newInstance(Constructor<?> c,
Object[] args)
throws IllegalAccessException,
InstantiationException,
InvocationTargetException
c - the constructor of the new instanceargs - the arguments to be passed to the constructor
IllegalAccessException - thrown if type is inaccessible
IllegalArgumentException - iff c is null or args does not
contain the number of arguments required by c (args may be null
if the arguments list is empty).
InstantiationException - if object could not be
instantiated (due to type being abstract or an interface or the
constructor caused an exception)
OutOfMemoryError - iff the space in this memory area is exhausted
ExceptionInInitializerError - iff initialization of class
type caused an exception.
InaccessibleAreaException - iff this memory area is not
accessible, i.e. not on the memory area stack.
InvocationTargetExceptionpublic long size()
public void executeInArea(Runnable logic)
throws InaccessibleAreaException
logic - the logic whose run method is to be executed in this
memory area.
InaccessibleAreaException
|
Jamaica 6.4 release 1
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||