|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.realtime.MemoryArea
javax.realtime.ScopedMemory
javax.realtime.LTMemory
public class LTMemory
LTMemory represents a memory area guaranteed by the system
to have linear time allocation when memory consumption from the memory
area is less than the memory area's initial size.
Execution time for allocation is allowed to vary when memory consumption is between
the initial size and the maximum size for the area. Furthermore, the underlying
system is not required
to guarantee that memory between initial and maximum will always be
available.
The memory
area described by a LTMemory instance does not exist in
the Java heap, and is not subject to garbage collection. Thus, it is
safe to use a LTMemory object as the initial memory area
associated with a NoHeapRealtimeThread, or to enter the
memory area using the ScopedMemory.enter() method within a
NoHeapRealtimeThread.
Enough memory must be committed by the completion of
the constructor to satisfy the initial memory requirement. (Committed means
that this memory must always be available for allocation). The
initial memory allocation must behave, with respect to successful
allocation, as if it were contiguous; i.e., a correct implementation
must guarantee that any sequence of object allocations that could
ever succeed without exceeding a specified initial memory size will
always succeed without exceeding that initial memory size and succeed
for any instance of LTMemory with that initial memory
size.
(Note: to ensure that all requested memory is available set initial and maximum to the same value)
Methods from LTMemory should be overridden only by methods that
use super.
MemoryArea,
ScopedMemory,
RealtimeThread,
NoHeapRealtimeThread| Constructor Summary | |
|---|---|
LTMemory(long size)
Create an LTMemory of the given size. |
|
LTMemory(long initial,
long maximum)
Create an LTMemory of the given size. |
|
LTMemory(long initial,
long maximum,
java.lang.Runnable logic)
Create an LTMemory of the given size. |
|
LTMemory(long size,
java.lang.Runnable logic)
Create an LTMemory of the given size. |
|
LTMemory(SizeEstimator size)
Create an LTMemory of the given size. |
|
LTMemory(SizeEstimator size,
java.lang.Runnable logic)
Create an LTMemory of the given size. |
|
LTMemory(SizeEstimator initial,
SizeEstimator maximum)
Create an LTMemory of the given size. |
|
LTMemory(SizeEstimator initial,
SizeEstimator maximum,
java.lang.Runnable logic)
Create an LTMemory of the given size. |
|
| Method Summary | |
|---|---|
long |
getMaximumSize()
Get the maximum size this memory area can attain. |
java.lang.String |
toString()
Create a string representation of this object. |
| Methods inherited from class javax.realtime.ScopedMemory |
|---|
enter, enter, executeInArea, 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 LTMemory(long initial,
long maximum)
LTMemory of the given size.
initial - The size in bytes of the memory to
allocate for this area. This memory must be committed
before the completion of the constructor.maximum - The size in bytes of the memory to
allocate for this area.
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 LTMemory
object or for the backing memory.
public LTMemory(long initial,
long maximum,
java.lang.Runnable logic)
LTMemory of the given size.
initial - The size in bytes of the memory to
allocate for this area. This memory must be committed
before the completion of the constructor.maximum - The size in bytes of the memory to
allocate for this area.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 LTMemory(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 LTMemory
object or for the backing memory.
IllegalAssignmentError - Thrown if storing logic in this
would violate the assignment rules.
public LTMemory(SizeEstimator initial,
SizeEstimator maximum)
LTMemory of the given size.
initial - An instance of SizeEstimator used to give an
estimate of the initial size.
This memory must be committed
before the completion of the constructor.maximum - An instance of SizeEstimator used to give an
estimate for the maximum bytes to allocate for this area.
java.lang.IllegalArgumentException - Thrown if initial is null, maximum
is null, initial
is greater than the size estimate from maximum, or
if initial
is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the LTMemory
object or for the backing memory.
public LTMemory(SizeEstimator initial,
SizeEstimator maximum,
java.lang.Runnable logic)
LTMemory of the given size.
initial - An instance of SizeEstimator used to give an
estimate of the initial size.
This memory must be committed
before the completion of the constructor.maximum - An instance of SizeEstimator used to give an
estimate for the maximum bytes to allocate for this area.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 LTMemory(SizeEstimator initial, SizeEstimator maximum).
java.lang.IllegalArgumentException - Thrown if initial is null, maximum
is null, initial
is greater than the size estimate from maximum, or
if initial
is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the LTMemory
object or for the backing memory.
IllegalAssignmentError - Thrown if storing logic in this
would violate the assignment rules.public LTMemory(long size)
LTMemory of the given size.
This constructor is equivalent to
LTMemory(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 LTMemory
object or for the backing memory.
public LTMemory(long size,
java.lang.Runnable logic)
LTMemory of the given size.
This constructor is equivalent to LTMemory(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 LTMemory(long size).
java.lang.IllegalArgumentException - Thrown if size
is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the LTMemory
object or for the backing memory.
IllegalAssignmentError - Thrown if storing logic in this
would violate the assignment rules.public LTMemory(SizeEstimator size)
LTMemory of the given size.
This constructor is equivalent to
LTMemory(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
is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the LTMemory
object or for the backing memory.- Since:
- 1.0.1
public LTMemory(SizeEstimator size,
java.lang.Runnable logic)
LTMemory 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 LTMemory(SizeEstimator initial).
java.lang.IllegalArgumentException - Thrown if size is null, or
size
is less than zero.
java.lang.OutOfMemoryError - Thrown if there is insufficient memory for the LTMemory
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()
(LTMemory) Scoped memory # num
where num
uniquely identifies the LTMemory area.
toString in class ScopedMemorythis.public long getMaximumSize()
ScopedMemory
getMaximumSize in class ScopedMemory
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||