JanosVM v1.0 API

edu.utah.janosvm.kit.util
Class SharedTableWriter

java.lang.Object
  |
  +--edu.utah.janosvm.kit.util.SharedTableWriter

public class SharedTableWriter
extends java.lang.Object

Provides read/write access to a shared table.


Field Summary
private  SharedTable lastGeneration
          The top of the stack of published SharedTables.
private  SharedTable newGeneration
          The newGeneration table contains any changes to the currently available shared data.
private static int READ_MISS_THRESHOLD
           
private  int readMisses
          The number of times that a read only succeeded in the newest table.
private  SharedTableReader tableReader
          The reader object that clients can use to lookup data in the current table.
 
Constructor Summary
SharedTableWriter()
           
 
Method Summary
 java.lang.Object get(java.lang.Object name)
          Get an object out of the table.
 SharedTableReader getReader()
           
 void put(java.lang.Object name, java.lang.Object obj)
          Put an association into the table.
 void remove(java.lang.Object name)
          Remove the given identifier and its associated object from the table.
 void sync()
          Synchronize the local table with the globally shared one.
 void sync(boolean collapse)
          Synchronize the local table with the globally shared one.
 java.lang.String toString()
           
 void walk(SharedTableWalker walker)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait, wait0
 

Field Detail

newGeneration

private SharedTable newGeneration
The newGeneration table contains any changes to the currently available shared data.

lastGeneration

private SharedTable lastGeneration
The top of the stack of published SharedTables.

tableReader

private final SharedTableReader tableReader
The reader object that clients can use to lookup data in the current table. Also, the pointer it holds is updated when the writer does a sync operation.

READ_MISS_THRESHOLD

private static final int READ_MISS_THRESHOLD

readMisses

private int readMisses
The number of times that a read only succeeded in the newest table. This is used to force a sync so that newly created and frequently used data will get published into the shared table.
Constructor Detail

SharedTableWriter

public SharedTableWriter()
Method Detail

put

public void put(java.lang.Object name,
                java.lang.Object obj)
Put an association into the table.
Parameters:
name - An identifier to associate with the given object.
obj - The object to store in the table.

get

public java.lang.Object get(java.lang.Object name)
Get an object out of the table.
Parameters:
name - The identifier associated with the object.
Returns:
The object associated with the given identifier.

remove

public void remove(java.lang.Object name)
Remove the given identifier and its associated object from the table.
Parameters:
name - The identifier to remove.

sync

public void sync(boolean collapse)
Synchronize the local table with the globally shared one. Basically, apply any differences from the last sync.
Parameters:
collapse - Force the collapse of the table stack.

sync

public void sync()
Synchronize the local table with the globally shared one. Basically, apply any differences from the last sync.

getReader

public SharedTableReader getReader()
Returns:
The SharedTableReader object connected to this writer.

walk

public void walk(SharedTableWalker walker)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

JanosVM v1.0 API

This documentation is Copyright (C) 2000-2003 The University of Utah. All Rights Reserved. See the documentation license for distribution terms and restrictions.
Documentation, software, and mailing lists for the JanosVM can be found at the Janos Project web page: http://www.cs.utah.edu/flux/janos/
Generated on Feb 13, 2003