java.lang.Objectjavax.realtime.MemoryArea
javax.realtime.ScopedMemory
javax.realtime.VTMemory
public class VTMemory
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 |
---|
public VTMemory(long initial, long maximum)
VTMemory
with the given 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.
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.public VTMemory(long initial, long maximum, java.lang.Runnable logic)
VTMemory
with the given 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)
.
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.public VTMemory(SizeEstimator initial, SizeEstimator maximum)
VTMemory
with the given 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
.
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.public VTMemory(SizeEstimator initial, SizeEstimator maximum, java.lang.Runnable logic)
VTMemory
with the given 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)
.
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.public VTMemory(long size)
VTMemory
of the given size.
This constructor is equivalent to
VTMemory(size, size)
size
- The size in bytes of the memory to
allocate for this area. This memory must be committed
before the completion of the constructor.
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.public VTMemory(long size, java.lang.Runnable logic)
VTMemory
of the given size.
This constructor is equivalent to VTMemory(size, size, logic)
.
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)
.
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.public VTMemory(SizeEstimator size)
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
public VTMemory(SizeEstimator size, java.lang.Runnable logic)
VTMemory
of the given size.
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)
.
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.Method Detail |
---|
public java.lang.String toString()
(VTMemory) Scoped memory # num
where num
uniquely identifies the VTMemory
area.
toString
in class ScopedMemory
this
.