javax.realtime
Class ImmortalPhysicalMemory

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

public class ImmortalPhysicalMemory
extends MemoryArea

An instance of ImmortalPhysicalMemory allows objects to be allocated from a range of physical memory with particular attributes, determined by their memory type. This memory area has the same restrictive set of assignment rules as ImmortalMemory memory areas, and may be used in any execution context where ImmortalMemory is appropriate.

Methods from ImmortalPhysicalMemory should be overridden only by methods that use super.


Constructor Summary
ImmortalPhysicalMemory(java.lang.Object type, long size)
          Create an instance with the given parameters.
ImmortalPhysicalMemory(java.lang.Object type, long base, long size)
          Create an instance with the given parameters.
ImmortalPhysicalMemory(java.lang.Object type, long base, long size, java.lang.Runnable logic)
          Create an instance with the given parameters.
ImmortalPhysicalMemory(java.lang.Object type, long size, java.lang.Runnable logic)
          Create an instance with the given parameters.
ImmortalPhysicalMemory(java.lang.Object type, long base, SizeEstimator size)
          Create an instance with the given parameters.
ImmortalPhysicalMemory(java.lang.Object type, long base, SizeEstimator size, java.lang.Runnable logic)
          Create an instance with the given parameters.
ImmortalPhysicalMemory(java.lang.Object type, SizeEstimator size)
          Create an instance with the given parameters.
ImmortalPhysicalMemory(java.lang.Object type, SizeEstimator size, java.lang.Runnable logic)
          Create an instance with the given parameters.
 
Method Summary
 void enter()
          Associate this memory area with the current schedulable object for the duration of the execution of the run() method of the instance of Runnable given in the constructor.
 void enter(java.lang.Runnable logic)
          Associate this memory area with the current schedulable object for the duration of the execution of the run() method of the given Runnable.
 void executeInArea(java.lang.Runnable logic)
          Execute the run method from the logic parameter using this memory area as the current allocation context.
 java.lang.Object newArray(java.lang.Class type, int number)
          Allocate an array of the given type 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 javax.realtime.MemoryArea
getMemoryArea, memoryConsumed, memoryRemaining
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImmortalPhysicalMemory

public ImmortalPhysicalMemory(java.lang.Object type,
                              long size)
Create an instance with the given parameters.

Parameters:
type - An instance of Object representing the type of memory required (e.g., dma, shared) - used to define the base address and control the mapping. If the required memory has more than one attribute type may be an array of objects. If type is null or a reference to an array with no entries, any type of memory is acceptable.
size - The size of the area in bytes.
Throws:
java.lang.SecurityException - Thrown if the application doesn't have permissions to access physical memory or the given type of memory.
UnsupportedPhysicalMemoryException - Thrown if the underlying hardware does not support the given type, or if no matching PhysicalMemoryTypeFilter has been registered with the PhysicalMemoryManager.
MemoryTypeConflictException - Thrown if type specifies incompatible memory attributes.
java.lang.IllegalArgumentException - Thrown if size is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the ImmortalPhysicalMemory object or for the backing memory.
SizeOutOfBoundsException - Thrown if the size extends into an invalid range of memory.

ImmortalPhysicalMemory

public ImmortalPhysicalMemory(java.lang.Object type,
                              long base,
                              long size)
Create an instance with the given parameters.

Parameters:
type - An instance of Object or an array of objects representing the type of memory required (e.g., dma, shared) - used to define the base address and control the mapping. If the required memory has more than one attribute type may be an array of objects. If type is null or a reference to an array with no entries, any type of memory is acceptable.
base - The physical memory address of the area.
size - The size of the area in bytes.
Throws:
java.lang.SecurityException - Thrown if the application doesn't have permissions to access physical memory or the given range of memory.
OffsetOutOfBoundsException - Thrown if the base address is invalid.
SizeOutOfBoundsException - Thrown if the size extends into an invalid range of memory.
UnsupportedPhysicalMemoryException - Thrown if the underlying hardware does not support the given type, or if no matching PhysicalMemoryTypeFilter has been registered with the PhysicalMemoryManager.
MemoryTypeConflictException - Thrown if the specified base does not point to memory that matches the requested type, or if type specifies incompatible memory attributes.
java.lang.IllegalArgumentException - Thrown if size is less than zero. IllegalArgumentException may also be thrown if base plus size would be greater than the maximum physical address supported by the processor.
MemoryInUseException - Thrown if the specified memory is already in use.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the ImmortalPhysicalMemory object or for the backing memory.

ImmortalPhysicalMemory

public ImmortalPhysicalMemory(java.lang.Object type,
                              SizeEstimator size)
Create an instance with the given parameters.

Parameters:
type - An instance of Object or an array of objects representing the type of memory required (e.g., dma, shared) - used to define the base address and control the mapping. If the required memory has more than one attribute type may be an array of objects. If type is null or a reference to an array with no entries, any type of memory is acceptable.
size - A size estimator for this area.
Throws:
java.lang.SecurityException - Thrown if the application doesn't have permissions to access physical memory or the given type of memory.
SizeOutOfBoundsException - Thrown if the size estimate from size extends into an invalid range of memory.
UnsupportedPhysicalMemoryException - Thrown if the underlying hardware does not support the given type, or if no matching PhysicalMemoryTypeFilter has been registered with the PhysicalMemoryManager.
MemoryTypeConflictException - Thrown if type specifies incompatible memory attributes.
java.lang.IllegalArgumentException - Thrown if size is null.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the ImmortalPhysicalMemory object or for the backing memory.

ImmortalPhysicalMemory

public ImmortalPhysicalMemory(java.lang.Object type,
                              long base,
                              SizeEstimator size)
Create an instance with the given parameters.

Parameters:
type - An instance of Object or an array of objects representing the type of memory required (e.g., dma, shared) - used to define the base address and control the mapping. If the required memory has more than one attribute type may be an array of objects. If type is null or a reference to an array with no entries, any type of memory is acceptable.
base - The physical memory address of the area.
size - A size estimator for this memory area.
Throws:
java.lang.SecurityException - Thrown if the application doesn't have permissions to access physical memory or the given type of memory.
OffsetOutOfBoundsException - Thrown if the base address is invalid.
SizeOutOfBoundsException - Thrown if the size estimate from size extends into an invalid range of memory.
UnsupportedPhysicalMemoryException - Thrown if the underlying hardware does not support the given type, or if no matching PhysicalMemoryTypeFilter has been registered with the PhysicalMemoryManager.
MemoryTypeConflictException - Thrown if the specified base does not point to memory that matches the requested type, or if type specifies incompatible memory attributes.
java.lang.IllegalArgumentException - Thrown if size is null. IllegalArgumentException may also be thrown if base plus the size indicated by size would be greater than the maximum physical address supported by the processor.
MemoryInUseException - Thrown if the specified memory is already in use.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the ImmortalPhysicalMemory object or for the backing memory.

ImmortalPhysicalMemory

public ImmortalPhysicalMemory(java.lang.Object type,
                              long size,
                              java.lang.Runnable logic)
Create an instance with the given parameters.

Parameters:
type - An instance of Object or an array of objects representing the type of memory required (e.g., dma, shared) - used to define the base address and control the mapping. If the required memory has more than one attribute type may be an array of objects. If type is null or a reference to an array with no entries, any type of memory is acceptable.
size - The size of the area in bytes.
logic - The run() method of this object will be called whenever MemoryArea.enter() is called. If logic is null, logic must be supplied when the memory area is entered.
Throws:
java.lang.SecurityException - Thrown if the application doesn't have permissions to access physical memory or the given type of memory.
SizeOutOfBoundsException - Thrown if size extends into an invalid range of memory.
UnsupportedPhysicalMemoryException - Thrown if the underlying hardware does not support the given type, or if no matching PhysicalMemoryTypeFilter has been registered with the PhysicalMemoryManager.
java.lang.IllegalArgumentException - Thrown if size is negative.
MemoryTypeConflictException - Thrown if the specified base does not point to memory that matches the requested type, or if type specifies incompatible memory attributes.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the ImmortalPhysicalMemory object or for the backing memory.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.

ImmortalPhysicalMemory

public ImmortalPhysicalMemory(java.lang.Object type,
                              long base,
                              long size,
                              java.lang.Runnable logic)
Create an instance with the given parameters.

Parameters:
type - An instance of Object or an array of objects representing the type of memory required (e.g., dma, shared) - used to define the base address and control the mapping. If the required memory has more than one attribute type may be an array of objects. If type is null or a reference to an array with no entries, any type of memory is acceptable.
base - The physical memory address of the area.
size - The size of the area in bytes.
logic - The run() method of this object will be called whenever MemoryArea.enter() is called. If logic is null, logic must be supplied when the memory area is entered.
Throws:
java.lang.SecurityException - Thrown if the application doesn't have permissions to access physical memory or the given type of memory.
OffsetOutOfBoundsException - Thrown if the base address is invalid.
SizeOutOfBoundsException - Thrown if size extends into an invalid range of memory.
UnsupportedPhysicalMemoryException - Thrown if the underlying hardware does not support the given type, or if no matching PhysicalMemoryTypeFilter has been registered with the PhysicalMemoryManager.
MemoryTypeConflictException - Thrown if the specified base does not point to memory that matches the requested type, or if type specifies incompatible memory attributes.
java.lang.IllegalArgumentException - Thrown if size is negative. IllegalArgumentException may also be thrown if base plus size would be greater than the maximum physical address supported by the processor.
MemoryInUseException - Thrown if the specified memory is already in use.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the ImmortalPhysicalMemory object or for the backing memory.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.

ImmortalPhysicalMemory

public ImmortalPhysicalMemory(java.lang.Object type,
                              SizeEstimator size,
                              java.lang.Runnable logic)
Create an instance with the given parameters.

Parameters:
type - An instance of Object or an array of objects representing the type of memory required (e.g., dma, shared) - used to define the base address and control the mapping. If the required memory has more than one attribute type may be an array of objects. If type is null or a reference to an array with no entries, any type of memory is acceptable.
size - A size estimator for this area.
logic - The run() method of this object will be called whenever MemoryArea.enter() is called. If logic is null, logic must be supplied when the memory area is entered.
Throws:
java.lang.SecurityException - Thrown if the application doesn't have permissions to access physical memory or the given type of memory.
SizeOutOfBoundsException - Thrown if the size extends into an invalid range of memory.
UnsupportedPhysicalMemoryException - Thrown if the underlying hardware does not support the given type, or if no matching PhysicalMemoryTypeFilter has been registered with the PhysicalMemoryManager.
java.lang.IllegalArgumentException - Thrown if size is null.
MemoryTypeConflictException - Thrown if type specifies incompatible memory attributes.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the ImmortalPhysicalMemory object or for the backing memory.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.

ImmortalPhysicalMemory

public ImmortalPhysicalMemory(java.lang.Object type,
                              long base,
                              SizeEstimator size,
                              java.lang.Runnable logic)
Create an instance with the given parameters.

Parameters:
type - An instance of Object or an array of objects representing the type of memory required (e.g., dma, shared) - used to define the base address and control the mapping. If the required memory has more than one attribute type may be an array of objects. If type is null or a reference to an array with no entries, any type of memory is acceptable.
base - The physical memory address of the area.
size - A size estimator for this memory area.
logic - The run() method of this object will be called whenever MemoryArea.enter() is called. If logic is null, logic must be supplied when the memory area is entered.
Throws:
java.lang.SecurityException - Thrown if the application doesn't have permissions to access physical memory or the given type of memory.
OffsetOutOfBoundsException - Thrown if the base address is invalid.
SizeOutOfBoundsException - Thrown if the size estimate from size extends into an invalid range of memory.
UnsupportedPhysicalMemoryException - Thrown if the underlying hardware does not support the given type, or if no matching PhysicalMemoryTypeFilter has been registered with the PhysicalMemoryManager.
MemoryTypeConflictException - Thrown if the specified base does not point to memory that matches the requested type, or if type specifies incompatible memory attributes.
java.lang.IllegalArgumentException - Thrown if size is null. IllegalArgumentException may also be thrown if base plus the size indicated by size would be greater than the maximum physical address supported by the processor.
MemoryInUseException - Thrown if the specified memory is already in use.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the ImmortalPhysicalMemory object or for the backing memory.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.
Method Detail

enter

public void enter()
Description copied from class: MemoryArea
Associate this memory area with the current schedulable object for the duration of the execution of the run() method of the instance of Runnable given in the constructor. During this period of execution, this memory area becomes the default allocation context until another default allocation context is selected (using enter, or MemoryArea.executeInArea(java.lang.Runnable)) or the enter method exits.

Overrides:
enter in class MemoryArea
Throws:
java.lang.IllegalThreadStateException - Thrown if the caller is a Java thread.
java.lang.IllegalArgumentException - Thrown no non-null value for logic was supplied when the memory area was constructed.
ThrowBoundaryError - Thrown when the JVM needs to propagate an exception allocated in this scope to (or through) the memory area of the caller. Storing a reference to that exception would cause an IllegalAssignmentError, so the JVM cannot be permitted to deliver the exception. The ThrowBoundaryError is allocated in the current allocation context and contains information about the exception it replaces.

enter

public void enter(java.lang.Runnable logic)
Description copied from class: MemoryArea
Associate this memory area with the current schedulable object for the duration of the execution of the run() method of the given Runnable. During this period of execution, this memory area becomes the default allocation context until another default allocation context is selected (using enter, or MemoryArea.executeInArea(java.lang.Runnable)) or the enter method exits.

Overrides:
enter in class MemoryArea
Parameters:
logic - The Runnable object whose run() method should be invoked.
Throws:
java.lang.IllegalThreadStateException - Thrown if the caller is a Java thread.
java.lang.IllegalArgumentException - Thrown if logic is null.
ThrowBoundaryError - Thrown when the JVM needs to propagate an exception allocated in this scope to (or through) the memory area of the caller. Storing a reference to that exception would cause an IllegalAssignmentError, so the JVM cannot be permitted to deliver the exception. The ThrowBoundaryError is allocated in the current allocation context and contains information about the exception it replaces.

size

public long size()
Description copied from class: MemoryArea
Query the size of the memory area. The returned value is the current size. Current size may be larger than initial size for those areas that are allowed to grow.

Overrides:
size in class MemoryArea
Returns:
The size of the memory area in bytes.

newInstance

public java.lang.Object newInstance(java.lang.Class type)
                             throws java.lang.InstantiationException,
                                    java.lang.IllegalAccessException
Description copied from class: MemoryArea
Allocate an object in this memory area. This method may be concurrently used by multiple threads.

Overrides:
newInstance in class MemoryArea
Parameters:
type - The class of which to create a new instance.
Returns:
A new instance of class type.
Throws:
java.lang.IllegalAccessException - The class or initializer is inaccessible.
java.lang.IllegalArgumentException - Thrown if type is null.
java.lang.InstantiationException - Thrown if 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 - Thrown if space in the memory area is exhausted.
java.lang.ExceptionInInitializerError - Thrown if an unexpected exception has occurred in a static initializer
java.lang.SecurityException - Thrown if the caller does not have permission to create a new instance.

newArray

public java.lang.Object newArray(java.lang.Class type,
                                 int number)
Description copied from class: MemoryArea
Allocate an array of the given type in this memory area. This method may be concurrently used by multiple threads.

Overrides:
newArray in class MemoryArea
Parameters:
type - The class of the elements of the new array. To create an array of a primitive type use a type such as Integer.TYPE (which would call for an array of the primitive int type.)
number - The number of elements in the new array.
Returns:
A new array of class type, of number elements.
Throws:
java.lang.IllegalArgumentException - Thrown if number is less than zero, type is null, or type is java.lang.Void.TYPE.
java.lang.OutOfMemoryError - Thrown if space in the memory area is exhausted.

newInstance

public java.lang.Object newInstance(java.lang.reflect.Constructor c,
                                    java.lang.Object[] args)
                             throws java.lang.IllegalAccessException,
                                    java.lang.InstantiationException,
                                    java.lang.reflect.InvocationTargetException
Description copied from class: MemoryArea
Allocate an object in this memory area. This method may be concurrently used by multiple threads.

Overrides:
newInstance in class MemoryArea
Parameters:
c - The constructor for the new instance.
args - An array of arguments to pass to the constructor.
Returns:
A new instance of the object constructed by c.
Throws:
java.lang.ExceptionInInitializerError - Thrown if an unexpected exception has occurred in a static initializer
java.lang.IllegalAccessException - Thrown if the class or initializer is inaccessible under Java access control.
java.lang.IllegalArgumentException - Thrown if c is null, or the args array does not contain the number of arguments required by c. A null value of args is treated like an array of length 0.
java.lang.InstantiationException - Thrown if the specified class object could not be instantiated. Possible causes are: it is an interface, it is abstract, it is an array.
java.lang.reflect.InvocationTargetException - Thrown if the underlying constructor throws an exception.
java.lang.OutOfMemoryError - Thrown if space in the memory area is exhausted.

executeInArea

public void executeInArea(java.lang.Runnable logic)
Description copied from class: MemoryArea
Execute the run method from the logic parameter using this memory area as the current allocation context. The effect of executeInArea on the scope stack is specified in the subclasses of MemoryArea.

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.