javax.realtime
Class LTPhysicalMemory

java.lang.Object
  extended by javax.realtime.MemoryArea
      extended by javax.realtime.ScopedMemory
          extended by javax.realtime.LTPhysicalMemory

public class LTPhysicalMemory
extends ScopedMemory

An instance of LTPhysicalMemory 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 semantics as ScopedMemory memory areas, and the same performance restrictions as LTMemory.

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

See Also:
MemoryArea, ScopedMemory, VTMemory, LTMemory, VTPhysicalMemory, ImmortalPhysicalMemory, RealtimeThread, NoHeapRealtimeThread
Mackinac comments:
Mackinac does not currently support physical memory attributes for location of Java objects. The type and base arguments are ignored.

Constructor Summary
LTPhysicalMemory(java.lang.Object type, long size)
          Create an instance of LTPhysicalMemory with the given parameters.
LTPhysicalMemory(java.lang.Object type, long base, long size)
          Create an instance of LTPhysicalMemory with the given parameters.
LTPhysicalMemory(java.lang.Object type, long base, long size, java.lang.Runnable logic)
          Create an instance of LTPhysicalMemory with the given parameters.
LTPhysicalMemory(java.lang.Object type, long size, java.lang.Runnable logic)
          Create an instance of LTPhysicalMemory with the given parameters.
LTPhysicalMemory(java.lang.Object type, long base, SizeEstimator size)
          Create an instance of LTPhysicalMemory with the given parameters.
LTPhysicalMemory(java.lang.Object type, long base, SizeEstimator size, java.lang.Runnable logic)
          Create an instance of LTPhysicalMemory with the given parameters.
LTPhysicalMemory(java.lang.Object type, SizeEstimator size)
          Create an instance of LTPhysicalMemory with the given parameters.
LTPhysicalMemory(java.lang.Object type, SizeEstimator size, java.lang.Runnable logic)
          Create an instance of LTPhysicalMemory 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 joinAndEnter()
          In the error-free case, joinAndEnter combines join();enter(); such that no enter() from another schedulable object can intervene between the two method invocations.
 void joinAndEnter(HighResolutionTime time)
          In the error-free case, joinAndEnter combines join();enter(); such that no enter() from another schedulable object can intervene between the two method invocations.
 void joinAndEnter(java.lang.Runnable logic)
          In the error-free case, joinAndEnter combines join();enter(); such that no enter() from another schedulable object can intervene between the two method invocations.
 void joinAndEnter(java.lang.Runnable logic, HighResolutionTime time)
          In the error-free case, joinAndEnter combines join();enter(); such that no enter() from another schedulable object can intervene between the two method invocations.
 long size()
          Query the size of the memory area.
 java.lang.String toString()
          Creates a string describing this object.
 
Methods inherited from class javax.realtime.ScopedMemory
executeInArea, getMaximumSize, getPortal, getReferenceCount, join, join, newArray, newInstance, newInstance, setPortal
 
Methods inherited from class javax.realtime.MemoryArea
getMemoryArea, memoryConsumed, memoryRemaining
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LTPhysicalMemory

public LTPhysicalMemory(java.lang.Object type,
                        long size)
Create an instance of LTPhysicalMemory 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.
java.lang.IllegalArgumentException - Thrown if size is less than zero.
SizeOutOfBoundsException - Thrown if the implementation detects size extends beyond physically addressable 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.
See Also:
PhysicalMemoryManager

LTPhysicalMemory

public LTPhysicalMemory(java.lang.Object type,
                        long base,
                        long size)
Create an instance of LTPhysicalMemory 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.
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 type of memory.
SizeOutOfBoundsException - Thrown if the size is less than zero, or the implementation detects that base plus size extends beyond physically addressable memory.
OffsetOutOfBoundsException - Thrown if the address is invalid.
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.
MemoryInUseException - Thrown if the specified memory is already in use.
See Also:
PhysicalMemoryManager

LTPhysicalMemory

public LTPhysicalMemory(java.lang.Object type,
                        SizeEstimator size)
Create an instance of LTPhysicalMemory 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 - 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 implementation detects that size extends beyond physically addressable 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.
See Also:
PhysicalMemoryManager

LTPhysicalMemory

public LTPhysicalMemory(java.lang.Object type,
                        long base,
                        SizeEstimator size)
Create an instance of LTPhysicalMemory 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.
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.
SizeOutOfBoundsException - Thrown if the implementation detects that base plus the size estimate extends beyond physically addressable memory.
OffsetOutOfBoundsException - Thrown if the address is invalid.
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.
MemoryInUseException - Thrown if the specified memory is already in use.
java.lang.IllegalArgumentException - Thrown if size is null.
See Also:
PhysicalMemoryManager

LTPhysicalMemory

public LTPhysicalMemory(java.lang.Object type,
                        long size,
                        java.lang.Runnable logic)
Create an instance of LTPhysicalMemory 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.
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.
java.lang.IllegalArgumentException - Thrown if size is less than zero.
SizeOutOfBoundsException - Thrown if the implementation detects that size extends beyond physically addressable 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.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.
See Also:
PhysicalMemoryManager

LTPhysicalMemory

public LTPhysicalMemory(java.lang.Object type,
                        long base,
                        long size,
                        java.lang.Runnable logic)
Create an instance of LTPhysicalMemory 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.
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:
SizeOutOfBoundsException - Thrown if the implementation detects that base plus size extends beyond physically addressable memory.
java.lang.SecurityException - Thrown if the application doesn't have permissions to access physical memory or the given type of memory.
java.lang.IllegalArgumentException - Thrown if size is less than zero.
OffsetOutOfBoundsException - Thrown if the address is invalid.
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.
MemoryInUseException - Thrown if the specified memory is already in use.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.
See Also:
PhysicalMemoryManager

LTPhysicalMemory

public LTPhysicalMemory(java.lang.Object type,
                        SizeEstimator size,
                        java.lang.Runnable logic)
Create an instance of LTPhysicalMemory 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 - 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 implementation detects that base plus the size estimate extends beyond physically addressable 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 request type, or if type specifies attributes with a conflict.
java.lang.IllegalArgumentException - Thrown if size is null.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.
See Also:
PhysicalMemoryManager

LTPhysicalMemory

public LTPhysicalMemory(java.lang.Object type,
                        long base,
                        SizeEstimator size,
                        java.lang.Runnable logic)
Create an instance of LTPhysicalMemory 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.
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.
SizeOutOfBoundsException - Thrown if the implementation detects that base plus the size estimate extends beyond physically addressable memory.
OffsetOutOfBoundsException - Thrown if the address is invalid.
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.
MemoryInUseException - Thrown if the specified memory is already in use.
java.lang.IllegalArgumentException - Thrown if size is null.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.
See Also:
PhysicalMemoryManager
Method Detail

enter

public 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. During this period of execution, this memory area becomes the default allocation context until another default allocation context is selected (using enter, or executeInArea (java.lang.Runnable)) or the enter method exits.

Overrides:
enter in class ScopedMemory
Throws:
ScopedCycleException - Thrown if this invocation would break the single parent rule.
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.
java.lang.IllegalThreadStateException - Thrown when enter is invoked from a Java thread.
java.lang.IllegalArgumentException - Thrown no non-null value for logic was supplied when the memory area was constructed.

enter

public 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. During this period of execution, this memory area becomes the default allocation context until another default allocation context is selected (using enter, or executeInArea(java.lang.Runnable)) or the enter method exits.

Overrides:
enter in class ScopedMemory
Parameters:
logic - The Runnable object whose run() method should be invoked.
Throws:
ScopedCycleException - Thrown if this invocation would break the single parent rule.
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.
java.lang.IllegalThreadStateException - Thrown when enter is invoked from a Java thread.
java.lang.IllegalArgumentException - Thrown if logic is null.

joinAndEnter

public void joinAndEnter()
                  throws java.lang.InterruptedException
In the error-free case, joinAndEnter combines join();enter(); such that no enter() from another schedulable object can intervene between the two method invocations. The resulting method will wait for the reference count on this ScopedMemory to reach zero, then enter the ScopedMemory and execute the run method from logic passed in the constructor. If no instance of Runnable was passed to the memory area's constructor, the method throws IllegalArgumentException immediately.

Overrides:
joinAndEnter in class ScopedMemory
Throws:
java.lang.InterruptedException - If this schedulable object is interrupted by RealtimeThread.interrupt() or AsynchronouslyInterruptedException.fire() while waiting for the reference count to go to zero.
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.
java.lang.IllegalArgumentException - Thrown if no non-null logic value was supplied to the memory area's constructor.

joinAndEnter

public void joinAndEnter(HighResolutionTime time)
                  throws java.lang.InterruptedException
In the error-free case, joinAndEnter combines join();enter(); such that no enter() from another schedulable object can intervene between the two method invocations. The resulting method will wait for the reference count on this ScopedMemory to reach zero, or for the current time to reach the designated time, then enter the ScopedMemory and execute the run method from Runnable object passed to the constructor. If no instance of Runnable was passed to the memory area's constructor, the method throws IllegalArgumentException immediately.

Note that expiration of time may cause control to enter the memory area before its reference count has gone to zero.

Overrides:
joinAndEnter in class ScopedMemory
Parameters:
time - The time that bounds the wait.
Throws:
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.
java.lang.InterruptedException - If this schedulable object is interrupted by RealtimeThread.interrupt() or AsynchronouslyInterruptedException.fire() while waiting for the reference count to go to zero.
ScopedCycleException - Thrown if this invocation would break the single parent rule.
java.lang.IllegalArgumentException - Thrown if time is null, or if no non-null logic value was supplied to the memory area's constructor.

joinAndEnter

public void joinAndEnter(java.lang.Runnable logic)
                  throws java.lang.InterruptedException
In the error-free case, joinAndEnter combines join();enter(); such that no enter() from another schedulable object can intervene between the two method invocations. The resulting method will wait for the reference count on this ScopedMemory to reach zero, then enter the ScopedMemory and execute the run method from logic

If logic is null, throw IllegalArgumentException immediately.

Overrides:
joinAndEnter in class ScopedMemory
Parameters:
logic - The Runnable object which contains the code to execute.
Throws:
java.lang.InterruptedException - If this schedulable object is interrupted by RealtimeThread.interrupt() or AsynchronouslyInterruptedException.fire() while waiting for the reference count to go to zero.
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.
java.lang.IllegalArgumentException - Thrown if logic is null.

joinAndEnter

public void joinAndEnter(java.lang.Runnable logic,
                         HighResolutionTime time)
                  throws java.lang.InterruptedException
In the error-free case, joinAndEnter combines join();enter(); such that no enter() from another schedulable object can intervene between the two method invocations. The resulting method will wait for the reference count on this ScopedMemory to reach zero, or for the current time to reach the designated time, then enter the ScopedMemory and execute the run method from logic.

Throws IllegalArgumentException immediately if logic is null.

Note that expiration of time may cause control to enter the memory area before its reference count has gone to zero.

Overrides:
joinAndEnter in class ScopedMemory
Parameters:
logic - The Runnable object which contains the code to execute.
time - The time that bounds the wait.
Throws:
java.lang.InterruptedException - If this schedulable object is interrupted by RealtimeThread.interrupt() or AsynchronouslyInterruptedException.fire() while waiting for the reference count to go to zero.
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.
ScopedCycleException - Thrown if this invocation would break the single parent rule.
java.lang.IllegalArgumentException - Thrown if time or logic is null.

toString

public java.lang.String toString()
Creates a string describing this object. The string is of the form
 (LTPhysicalMemory) Scoped memory # num
 
where num is a number that uniquely identifies this LTPhysicalMemory memory area. representing the value of this.

Overrides:
toString in class ScopedMemory
Returns:
A string representing the value of this.

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.