javax.realtime
Class CTPrivateMemory

java.lang.Object
  extended byjavax.realtime.MemoryArea
      extended byjavax.realtime.ScopedMemory
          extended byjavax.realtime.PrivateScopedMemory
              extended byjavax.realtime.CTPrivateMemory

public class CTPrivateMemory
extends PrivateScopedMemory

The CTPrivateMemory provides constant time allocation time. This type of scoped memory allows only one thread at the time to be within it. Thus it can be considered as a thread private memory. If more than one thread try to access it at the same time a run-time exception is thrown.

Author:
Angelo Corsaro, Morgan Deters

Field Summary
 
Fields inherited from class javax.realtime.PrivateScopedMemory
owner
 
Fields inherited from class javax.realtime.ScopedMemory
joinSynchronizer
 
Fields inherited from class javax.realtime.MemoryArea
logic, parent, sizeInBytes
 
Constructor Summary
CTPrivateMemory(long size)
          Creates an CTPrivateMemory of the given size.
CTPrivateMemory(long initial, long maximum)
          Creates an CTPrivateMemory of the given initial and maximal sizes.
CTPrivateMemory(long initial, long maximum, Runnable logic)
          Creates an CTPrivateMemory of the given initial and maximal sizes, associated with the given Runnable.
CTPrivateMemory(long size, Runnable logic)
          Creates an CTPrivateMemory of the given size, associated with the given Runnable.
CTPrivateMemory(SizeEstimator size)
          Creates an CTPrivateMemory of the given size.
CTPrivateMemory(SizeEstimator size, Runnable logic)
          Creates an CTPrivateMemory of the given size, associated with the given Runnable.
CTPrivateMemory(SizeEstimator initial, SizeEstimator maximum)
          Creates an CTPrivateMemory of the given initial and maximal sizes.
CTPrivateMemory(SizeEstimator initial, SizeEstimator maximum, Runnable logic)
          Creates an CTPrivateMemory 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.PrivateScopedMemory
enter, join, join, joinAndEnter, joinAndEnter, joinAndEnter, joinAndEnter, resetOwner, setOwner
 
Methods inherited from class javax.realtime.ScopedMemory
enter, getMaximumSize, getPortal, getReferenceCount, 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

CTPrivateMemory

public CTPrivateMemory(long size)
Creates an CTPrivateMemory 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

CTPrivateMemory

public CTPrivateMemory(long initial,
                       long maximum)
Creates an CTPrivateMemory 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

CTPrivateMemory

public CTPrivateMemory(long initial,
                       long maximum,
                       Runnable logic)
Creates an CTPrivateMemory 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

CTPrivateMemory

public CTPrivateMemory(long size,
                       Runnable logic)
Creates an CTPrivateMemory 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

CTPrivateMemory

public CTPrivateMemory(SizeEstimator size)
Creates an CTPrivateMemory 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

CTPrivateMemory

public CTPrivateMemory(SizeEstimator initial,
                       SizeEstimator maximum)
Creates an CTPrivateMemory 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

CTPrivateMemory

public CTPrivateMemory(SizeEstimator initial,
                       SizeEstimator maximum,
                       Runnable logic)
Creates an CTPrivateMemory 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

CTPrivateMemory

public CTPrivateMemory(SizeEstimator size,
                       Runnable logic)
Creates an CTPrivateMemory 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 "(CTPrivateMemory) Scoped memory # N" where N is a unique ID identifying this scoped memory area.

Please see the implementation note.

Overrides:
toString in class PrivateScopedMemory
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.