javax.realtime
Class Arena

java.lang.Object
  extended byjavax.realtime.MemoryArea
      extended byjavax.realtime.Arena
Direct Known Subclasses:
RefCountedArena

public abstract class Arena
extends MemoryArea

Arena is the base class for all those memory areas whose lifetime depends on reachability. Depending on the type of Arena, the objects allocated within it are collected either based on reachability or all at once.

Author:
Angelo Corsaro

Field Summary
 
Fields inherited from class javax.realtime.MemoryArea
logic, parent, sizeInBytes
 
Constructor Summary
protected Arena(long size)
          Creates a new Arena instance.
protected Arena(long size, Runnable logic)
          Creates a new Arena instance.
protected Arena(SizeEstimator size)
          Creates a new Arena instance.
protected Arena(SizeEstimator size, Runnable logic)
          Creates a new RefCountedArena instance.
 
Method Summary
 long getMaximumSize()
          Get the maximum size this memory area can attain.
 Object getPortal()
          Returns a reference to the portal object in this instance of ScopedMemory
 void setPortal(Object portal)
          Set the argument to the portal object in the memory area represented by this instance of ScopedMemory.
 
Methods inherited from class javax.realtime.MemoryArea
enter, enter, executeInArea, finalize, fini, getMemoryArea, guardedRun, init, memoryConsumed, memoryRemaining, newArray, newInstance, newInstance, size
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Arena

protected Arena(long size)
Creates a new Arena instance.

Parameters:
size - a long value indicating the Arena size

Arena

protected Arena(SizeEstimator size)
Creates a new Arena instance.

Parameters:
size - a long value indicating the Arena size

Arena

protected Arena(long size,
                Runnable logic)
Creates a new Arena instance.

Parameters:
size - a long value indicating the RefCountedArena size
logic - a Runnable value

Arena

protected Arena(SizeEstimator size,
                Runnable logic)
Creates a new RefCountedArena instance.

Parameters:
size - a long value indicating the RefCountedArena size
Method Detail

getMaximumSize

public long getMaximumSize()
Get the maximum size this memory area can attain. If this is a fixed size memorea area, the returned value will be equal to the initial size.

Returns:
The maximum size attainable.

getPortal

public Object getPortal()
Returns a reference to the portal object in this instance of ScopedMemory

Returns:
A reference to the portal or null if there is no portal set.

setPortal

public void setPortal(Object portal)
Set the argument to the portal object in the memory area represented by this instance of ScopedMemory.

A portal can serve as a means of interthread communication and they are used primarily when threads need to share an object that is allocated in a ScopedMemory. The portal object for a ScopedMemory must be allocated in a ScopedMemory that is outer then the current.

Parameters:
portal - The object which will become the portal for this. If null the previous portal object remains the portal object for this or if there was no previous portal object then there is still no portal object for this.


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