javax.realtime
Class CTMemory

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

public class CTMemory
extends ScopedMemory

The CTMemory provides constant time allocation time.

Author:
Angelo Corsaro

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 a new CTMemory instance.
CTMemory(long minSize, long maxSize)
          Creates a new CTMemory instance.
CTMemory(long size, Runnable logic)
          Creates a new CTMemory instance.
CTMemory(SizeEstimator size)
          Creates a new CTMemory instance.
CTMemory(SizeEstimator size, Runnable logic)
          Creates a new CTMemory instance.
 
Method Summary
protected  void fini()
           
protected  void init()
           
 long memoryConsumed()
          An exact count, in bytes, of the all of the memory currently used by the system for the allocated objects.
 long memoryRemaining()
          An approximation to the total amount of memory currently available for future allocated objects, measured in bytes.
 
Methods inherited from class javax.realtime.ScopedMemory
enter, getMaximumSize, getPortal, getReferenceCount, join, join, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, setPortal, toString
 
Methods inherited from class javax.realtime.MemoryArea
enter, executeInArea, finalize, getMemoryArea, guardedRun, 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 minSize,
                long maxSize)
Creates a new CTMemory instance.

Parameters:
minSize - a long value representing the minimum size for this memory.
maxSize - a long value representing the max size for this memory area.

CTMemory

public CTMemory(long size)
Creates a new CTMemory instance.

Parameters:
size - The size of MemoryArea to allocate, in bytes. If size is less than or equal to zero an IllegalArgumentException is thrown.

CTMemory

public CTMemory(long size,
                Runnable logic)
Creates a new CTMemory instance.

Parameters:
size - The size of MemoryArea to allocate, in bytes. If size is less than or equal to zero an IllegalArgumentException is thrown.
logic - -The java.lang.Runnable whose run() method is invoked when any of the variations of enter() which do not take a java.lang.Runnable is called.

CTMemory

public CTMemory(SizeEstimator size)
Creates a new CTMemory instance.

Parameters:
size - A SizeEstimator object which indicates the amount of memory required by this MemoryArea.

CTMemory

public CTMemory(SizeEstimator size,
                Runnable logic)
Creates a new CTMemory instance.

Parameters:
size - The size of MemoryArea to allocate, in bytes.
logic - The run() method of this object will be called whenever enter() called.
Method Detail

memoryConsumed

public long memoryConsumed()
An exact count, in bytes, of the all of the memory currently used by the system for the allocated objects.

Specified by:
memoryConsumed in class MemoryArea
Returns:
The amount of memory consumed in bytes.

memoryRemaining

public long memoryRemaining()
An approximation to the total amount of memory currently available for future allocated objects, measured in bytes.

Specified by:
memoryRemaining in class MemoryArea
Returns:
The amount of remaining memory in bytes.

init

protected void init()
Specified by:
init in class MemoryArea

fini

protected void fini()
Specified by:
fini in class MemoryArea


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