JanosVM v1.0 API

edu.utah.janosvm.kit.comm.commspace
Class CommSpace

java.lang.Object
  |
  +--edu.utah.janosvm.sys.Exportable
        |
        +--edu.utah.janosvm.kit.comm.commspace.CommSpace
All Implemented Interfaces:
TemporaryExport

class CommSpace
extends Exportable
implements TemporaryExport

Variation on an array, with some tuple-space like properties. Objects are not shared between flows, they are copied on read.

Author:
Janos Ministry of Development

Field Summary
private  CommSpaceElement[] table
          The table mapping indicies to elements.
 
Fields inherited from class edu.utah.janosvm.sys.Exportable
anonManager, owner
 
Constructor Summary
(package private) CommSpace(int size)
           
 
Method Summary
private  void checkIndex(int index)
           
 boolean expired()
          This method is called when there are no more imports for the export.
 java.lang.Object getName()
          Used to determine the name of this TemporaryObject object during revocation.
private  void notifyOnIndex(int index)
          Notify potential interested parties about a change at the given index.
(package private)  CommSpaceElement read(int index)
           
(package private)  int size()
           
(package private)  CommSpaceElement swap(int index, CommSpaceElement elem)
           
(package private)  CommSpaceElement take(int index)
           
 java.lang.String toString()
           
private  void waitOnIndex(int index)
          Wait for something to change in the slot at the given index.
(package private)  CommSpaceElement waitToTake(int index)
           
(package private)  void write(int index, CommSpaceElement elem)
          Write the given element at the given index.
 
Methods inherited from class edu.utah.janosvm.sys.Exportable
getAnonymousManager, pushOwnerReservation, returnFromOwner, setAnonymousManager, switchToOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait, wait0
 

Field Detail

table

private final CommSpaceElement[] table
The table mapping indicies to elements.
Constructor Detail

CommSpace

CommSpace(int size)
Parameters:
size - The size of CommSpace to construct.
Method Detail

getName

public java.lang.Object getName()
Description copied from interface: TemporaryExport
Used to determine the name of this TemporaryObject object during revocation. Should return null for an anonymous export.
Specified by:
getName in interface TemporaryExport

size

final int size()
Returns:
The size of the CommSpace.

checkIndex

private final void checkIndex(int index)
Parameters:
index - Index to verify that it is within the bounds of the space.
Throws:
java.lang.ArrayIndexOutOfBoundsException - when the index is not valid.

write

void write(int index,
           CommSpaceElement elem)
     throws java.lang.ArrayIndexOutOfBoundsException
Write the given element at the given index.

take

CommSpaceElement take(int index)
                throws java.lang.ArrayIndexOutOfBoundsException

waitToTake

CommSpaceElement waitToTake(int index)
                      throws java.lang.ArrayIndexOutOfBoundsException,
                             java.lang.InterruptedException

read

CommSpaceElement read(int index)
                throws java.lang.ArrayIndexOutOfBoundsException

swap

CommSpaceElement swap(int index,
                      CommSpaceElement elem)

notifyOnIndex

private void notifyOnIndex(int index)
Notify potential interested parties about a change at the given index.

waitOnIndex

private void waitOnIndex(int index)
                  throws java.lang.InterruptedException
Wait for something to change in the slot at the given index.

expired

public boolean expired()
Description copied from interface: TemporaryExport
This method is called when there are no more imports for the export. If it returns true than the export is revoked otherwise it will continue to be available for importing.
Specified by:
expired in interface TemporaryExport
Following copied from interface: edu.utah.janosvm.sys.TemporaryExport
Returns:
True if the export has expired and should be revoked.

toString

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

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