javax.realtime
Class LTPrivateMemory

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

public class LTPrivateMemory
extends PrivateScopedMemory

The LTPrivateMemory provides linear 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
LTPrivateMemory(long size)
          Creates an LTPrivateMemory of the given size.
LTPrivateMemory(long initial, long maximum)
          Creates an LTPrivateMemory of the given initial and maximal sizes.
LTPrivateMemory(long initial, long maximum, Runnable logic)
          Creates an LTPrivateMemory of the given initial and maximal sizes, associated with the given Runnable.
LTPrivateMemory(long size, Runnable logic)
          Creates an LTPrivateMemory of the given size, associated with the given Runnable.
LTPrivateMemory(SizeEstimator size)
          Creates an LTPrivateMemory of the given size.
LTPrivateMemory(SizeEstimator size, Runnable logic)
          Creates an LTPrivateMemory of the given size, associated with the given Runnable.
LTPrivateMemory(SizeEstimator initial, SizeEstimator maximum)
          Creates an LTPrivateMemory of the given initial and maximal sizes.
LTPrivateMemory(SizeEstimator initial, SizeEstimator maximum, Runnable logic)
          Creates an LTPrivateMemory 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

LTPrivateMemory

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

LTPrivateMemory

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

LTPrivateMemory

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

LTPrivateMemory

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

LTPrivateMemory

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

LTPrivateMemory

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

LTPrivateMemory

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

LTPrivateMemory

public LTPrivateMemory(SizeEstimator size,
                       Runnable logic)
Creates an LTPrivateMemory 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 "(LTPrivateMemory) 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.