javax.realtime
Class VTMemory

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

public class VTMemory
extends ScopedMemory

VTMemory is similar to LTMemory except that the execution time of an allocation from a VTMemory area need not complete in linear time.

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


Constructor Summary
VTMemory(long size)
          Create an VTMemory of the given size.
VTMemory(long initial, long maximum)
          Creates a VTMemory with the given parameters.
VTMemory(long initial, long maximum, java.lang.Runnable logic)
          Creates a VTMemory with the given parameters.
VTMemory(long size, java.lang.Runnable logic)
          Create an VTMemory of the given size.
VTMemory(SizeEstimator size)
          Create an VTMemory of the given size.
VTMemory(SizeEstimator size, java.lang.Runnable logic)
          Create an VTMemory of the given size.
VTMemory(SizeEstimator initial, SizeEstimator maximum)
          Creates a VTMemory with the given parameters.
VTMemory(SizeEstimator initial, SizeEstimator maximum, java.lang.Runnable logic)
          Creates a VTMemory with the given parameters.
 
Method Summary
 java.lang.String toString()
          Create a string representing this object.
 
Methods inherited from class javax.realtime.ScopedMemory
enter, enter, executeInArea, getMaximumSize, getPortal, getReferenceCount, join, join, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, newArray, newInstance, newInstance, setPortal
 
Methods inherited from class javax.realtime.MemoryArea
getMemoryArea, memoryConsumed, memoryRemaining, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VTMemory

public VTMemory(long initial,
                long maximum)
Creates a VTMemory with the given parameters.

Parameters:
initial - The size in bytes of the memory to initially allocate for this area.
maximum - The maximum size in bytes this memory area to which the size may grow.
Throws:
java.lang.IllegalArgumentException - Thrown if initial is greater than maximum or if initial or maximum is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the VTMemory object or for the backing memory.

VTMemory

public VTMemory(long initial,
                long maximum,
                java.lang.Runnable logic)
Creates a VTMemory with the given parameters.

Parameters:
initial - The size in bytes of the memory to initially allocate for this area.
maximum - The maximum size in bytes this memory area to which the size may grow.
logic - An instance of Runnable whose run() method will use this as its initial memory area. If logic is null, this constructor is equivalent to VTMemory(long initial, long maximum).
Throws:
java.lang.IllegalArgumentException - Thrown if initial is greater than maximum, or if initial or maximum is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the VTMemory object or for the backing memory.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.

VTMemory

public VTMemory(SizeEstimator initial,
                SizeEstimator maximum)
Creates a VTMemory with the given parameters.

Parameters:
initial - The size in bytes of the memory to initially allocate for this area.
maximum - The maximum size in bytes this memory area to which the size may grow estimated by an instance of SizeEstimator.
Throws:
java.lang.IllegalArgumentException - Thrown if initial is null, maximum is null, initial.getEstimate() is greater than maximum.getEstimate(), or if initial.getEstimate() is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the VTMemory object or for the backing memory.

VTMemory

public VTMemory(SizeEstimator initial,
                SizeEstimator maximum,
                java.lang.Runnable logic)
Creates a VTMemory with the given parameters.

Parameters:
initial - The size in bytes of the memory to initially allocate for this area.
maximum - The maximum size in bytes this memory area to which the size may grow estimated by an instance of SizeEstimator.
logic - An instance of Runnable whose run() method will use this as its initial memory area. If logic is null, this constructor is equivalent to VTMemory(SizeEstimator initial, SizeEstimator maximum).
Throws:
java.lang.IllegalArgumentException - Thrown if initial is null, maximum is null, initial.getEstimate() is greater than maximum.getEstimate(), or if initial.getEstimate() is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the VTMemory object or for the backing memory.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.

VTMemory

public VTMemory(long size)
Create an VTMemory of the given size. This constructor is equivalent to VTMemory(size, size)

Parameters:
size - The size in bytes of the memory to allocate for this area. This memory must be committed before the completion of the constructor.
Throws:
java.lang.IllegalArgumentException - Thrown if size is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the VTMemory object or for the backing memory.
Since:
1.0.1

VTMemory

public VTMemory(long size,
                java.lang.Runnable logic)
Create an VTMemory of the given size. This constructor is equivalent to VTMemory(size, size, logic).

Parameters:
size - The size in bytes of the memory to allocate for this area. This memory must be committed before the completion of the constructor.
logic - The run() of the given Runnable will be executed using this as its initial memory area. If logic is null, this constructor is equivalent to VTMemory(long size).
Throws:
java.lang.IllegalArgumentException - Thrown if size is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the VTMemory object or for the backing memory.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.
Since:
1.0.1

VTMemory

public VTMemory(SizeEstimator size)
Create an VTMemory of the given size. This constructor is equivalent to VTMemory(size, size).

Parameters:
size - An instance of SizeEstimator used to give an estimate of the initial size. This memory must be committed before the completion of the constructor.
Throws:
java.lang.IllegalArgumentException - Thrown if size is null, or size.getEstimate() is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the VTMemory object or for the backing memory.
Since:
1.0.1

VTMemory

public VTMemory(SizeEstimator size,
                java.lang.Runnable logic)
Create an VTMemory of the given size.

Parameters:
size - An instance of SizeEstimator used to give an estimate of the initial size. This memory must be committed before the completion of the constructor.
logic - The run() of the given Runnable will be executed using this as its initial memory area. If logic is null, this constructor is equivalent to VTMemory(SizeEstimator initial).
Throws:
java.lang.IllegalArgumentException - Thrown if size is null, or size.getEstimate() is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the VTMemory object or for the backing memory.
IllegalAssignmentError - Thrown if storing logic in this would violate the assignment rules.
Since:
1.0.1
Method Detail

toString

public java.lang.String toString()
Create a string representing this object. The string is of the form
 (VTMemory) Scoped memory # num
 
where num uniquely identifies the VTMemory area.

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