|
JanosVM v1.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.utah.janosvm.sys.ListNode | +--edu.utah.janosvm.sys.Importable | +--edu.utah.janosvm.kit.comm.commspace.CommSpaceHandle
A handle on a CommSpace. A CommSpace is an inter-process communication facility based lightly on Linda's "tuples". The space consists of an array of CommSpaceElements. Elements are copied out on read. A thread may write, read, swap, "wait" or "take" any element.
XXX Semantics during a failed take() are probably wrong.
CommSpace
Field Summary | |
private CommSpace |
cs
|
Fields inherited from class edu.utah.janosvm.sys.Importable |
em |
Fields inherited from class edu.utah.janosvm.sys.ListNode |
pred, succ |
Constructor Summary | |
CommSpaceHandle()
Create an empty handle. |
|
CommSpaceHandle(CommSpaceHandle other)
Copy constructor. |
Method Summary | |
protected void |
bindTo(Exportable ex)
Bind this Importable to the given Exportable. |
(package private) boolean |
empty()
XXX Without this being public there is no way to tell if this thing actually points to a commSpace. |
static CommSpaceHandle |
newCommSpace(CommSpaceHandle csh,
int size)
Create a CommSpace and attach it to the given handle. |
static CommSpaceHandle |
newCommSpace(int size)
Create a new CommSpace of the given size and return a handle to it. |
CommSpaceElement |
read(int index)
Read the element at the given index. |
int |
resize(int newsize)
Resize the CommSpace pointed to by this handle to contain the given number of slots. |
int |
size()
Return the number of slots in the CommSpace pointed to by this handle. |
CommSpaceElement |
swap(int index,
CommSpaceElement elem)
Swap an element with the one currently in the given index. |
CommSpaceElement |
take(int index)
Take an element from the given index and put a null in its place. |
protected void |
unbindFrom()
Unbind this Importable from any objects it is referencing. |
CommSpaceElement |
waitToTake(int index)
Wait for an element to be placed into the given index. |
void |
write(int index,
CommSpaceElement elem)
Write the given element to the given index. |
Methods inherited from class edu.utah.janosvm.sys.Importable |
copy, finalize, getExportManager, revoke, setExportManager, toString |
Methods inherited from class edu.utah.janosvm.sys.ListNode |
append, clone, inList, prepend, remove |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait, wait0 |
Field Detail |
private CommSpace cs
Constructor Detail |
public CommSpaceHandle()
newCommSpace(CommSpaceHandle,int)
public CommSpaceHandle(CommSpaceHandle other)
other
- The handle to copy.Method Detail |
public static CommSpaceHandle newCommSpace(int size)
size
- The size of the CommSpace.public static CommSpaceHandle newCommSpace(CommSpaceHandle csh, int size)
csh
- The CommSpaceHandle to attach to the newly created
CommSpace.size
- The size of the CommSpace.protected final void bindTo(Exportable ex)
Importable
This method will be invoked as a side-effect of binding this
importable to an Exportable object via TeamHandle.importObject(edu.utah.janosvm.sys.Importable, java.lang.Object)
.
XXX Add note about synchronized.
bindTo
in class Importable
edu.utah.janosvm.sys.Importable
ex
- The Exportable that is being imported.protected final void unbindFrom()
Importable
This method will be invoked as a side-effect of canceling this import
, or when the
Team owning the Exportable is terminated
, or when the Exportable is revoked
.
XXX rename to just 'unbind'.
unbindFrom
in class Importable
edu.utah.janosvm.sys.Importable
TeamHandle.cancelImport(edu.utah.janosvm.sys.Importable)
,
Team.revokeObject(java.lang.Object)
,
TeamHandle.terminate()
boolean empty()
public int size()
public int resize(int newsize)
XXX what happens when resizing to smaller than current and dropping items?
public void write(int index, CommSpaceElement elem) throws java.lang.ArrayIndexOutOfBoundsException
index
- The index in the CommSpace to write into.elem
- The element to copy into the CommSpace.public CommSpaceElement take(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- The index in the CommSpace that we should take.swap(int,CommSpaceElement)
public CommSpaceElement waitToTake(int index) throws java.lang.InterruptedException, java.lang.ArrayIndexOutOfBoundsException
index
- The index in the CommSpace that we should take.public CommSpaceElement read(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- The index in the CommSpace that we should take.public CommSpaceElement swap(int index, CommSpaceElement elem) throws java.lang.ArrayIndexOutOfBoundsException
index
- The index in the CommSpace that we should take.elem
- The element to swap into the index.
|
JanosVM v1.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |