javax.realtime
Class CTMemory

java.lang.Object
  extended byjavax.realtime.MemoryArea
      extended byjavax.realtime.ScopedMemory
          extended byjavax.realtime.CTMemory

public class CTMemory
extends ScopedMemory

A scoped memory area with an allocator that operates in constant-bounded time (with respect to the size of the allocation request). This is done by zeroing the entire memory area when the CTMemory is entered (rather than piecemeal, as allocations are performed).

Author:
Angelo Corsaro, Morgan Deters

Field Summary
 
Fields inherited from class javax.realtime.ScopedMemory
joinSynchronizer
 
Fields inherited from class javax.realtime.MemoryArea
logic, parent, sizeInBytes
 
Constructor Summary
CTMemory(long size)
          Creates an CTMemory of the given size.
CTMemory(long initial, long maximum)
          Creates an CTMemory of the given initial and maximal sizes.
CTMemory(long initial, long maximum, Runnable logic)
          Creates an CTMemory of the given initial and maximal sizes, associated with the given Runnable.
CTMemory(long size, Runnable logic)
          Creates an CTMemory of the given size, associated with the given Runnable.
CTMemory(SizeEstimator size)
          Creates an CTMemory of the given size.
CTMemory(SizeEstimator size, Runnable logic)
          Creates an CTMemory of the given size, associated with the given Runnable.
CTMemory(SizeEstimator initial, SizeEstimator maximum)
          Creates an CTMemory of the given initial and maximal sizes.
CTMemory(SizeEstimator initial, SizeEstimator maximum, Runnable logic)
          Creates an CTMemory of the given initial and maximal sizes, associated with the given Runnable.
 
Method Summary
 String toString()
          Returns a user-friendly representation of this ScopedMemory.
 
Methods inherited from class javax.realtime.ScopedMemory
enter, enter, getMaximumSize, getPortal, getReferenceCount, join, join, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, setPortal
 
Methods inherited from class javax.realtime.MemoryArea
executeInArea, finalize, getMemoryArea, guardedRun, memoryConsumed, memoryRemaining, newArray, newInstance, newInstance, size
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CTMemory

public CTMemory(long size)
Creates an CTMemory of the given size.

Parameters:
size - the size of the memory area to create
Throws:
IllegalArgumentException - if size is less than zero
OutOfMemoryError - if there isn't enough storage available for the backing memory

CTMemory

public CTMemory(long initial,
                long maximum)
Creates an CTMemory of the given initial and maximal sizes.

Parameters:
initial - the initial size for this memory area
maximum - the maximum size for this memory area
Throws:
IllegalArgumentException - if initial is less than zero or greater than maximum
OutOfMemoryError - if there isn't enough storage available for the backing memory

CTMemory

public CTMemory(long initial,
                long maximum,
                Runnable logic)
Creates an CTMemory of the given initial and maximal sizes, associated with the given Runnable.

Parameters:
initial - the initial size for this memory area
maximum - the maximum size for this memory area
logic - the Runnable to associate
Throws:
IllegalArgumentException - if initial is less than zero or greater than maximum
IllegalAssignmentError - if storing logic in this violates referencing rules
OutOfMemoryError - if there isn't enough storage available for the backing memory

CTMemory

public CTMemory(long size,
                Runnable logic)
Creates an CTMemory of the given size, associated with the given Runnable.

Parameters:
size - the size of the memory area to create
logic - the Runnable to associate
Throws:
IllegalArgumentException - if size is less than zero
IllegalAssignmentError - if storing logic in this violates referencing rules
OutOfMemoryError - if there isn't enough storage available for the backing memory

CTMemory

public CTMemory(SizeEstimator size)
Creates an CTMemory of the given size.

Parameters:
size - the size of the memory area to create
Throws:
IllegalArgumentException - if size is null
OutOfMemoryError - if there isn't enough storage available for the backing memory

CTMemory

public CTMemory(SizeEstimator initial,
                SizeEstimator maximum)
Creates an CTMemory of the given initial and maximal sizes.

Parameters:
initial - the initial size for this memory area
maximum - the maximum size for this memory area
Throws:
IllegalArgumentException - if initial is greater than maximum, or if either is null
OutOfMemoryError - if there isn't enough storage available for the backing memory

CTMemory

public CTMemory(SizeEstimator initial,
                SizeEstimator maximum,
                Runnable logic)
Creates an CTMemory of the given initial and maximal sizes, associated with the given Runnable.

Parameters:
initial - the initial size for this memory area
maximum - the maximum size for this memory area
logic - the Runnable to associate
Throws:
IllegalArgumentException - if initial is greater than maximum, or if either is null
IllegalAssignmentError - if storing logic in this violates referencing rules
OutOfMemoryError - if there isn't enough storage available for the backing memory

CTMemory

public CTMemory(SizeEstimator size,
                Runnable logic)
Creates an CTMemory of the given size, associated with the given Runnable.

Parameters:
size - the size of the memory area to create
logic - the Runnable to associate
Throws:
IllegalArgumentException - if size is null
IllegalAssignmentError - if storing logic in this violates referencing rules
OutOfMemoryError - if there isn't enough storage available for the backing memory
Method Detail

toString

public String toString()
Returns a user-friendly representation of this ScopedMemory. This String is of the form "(CTMemory) Scoped memory # N" where N is a unique ID identifying this scoped memory area.

Please see the implementation note in the superclass.

Overrides:
toString in class ScopedMemory
Returns:
the user-friendly String representation


jRate is developed and maintained by the jRate project development team.
Copyright (c) 2001-2006 Angelo Corsaro and Morgan Deters.