|
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.sys.TeamHandle
Provides a safe handle to a Team. Technically, this points to the kernel team's TeamBackEnd object that represents the team in question.
Allocating a TeamHandle does not create a team. See the create
methods in Team
.
TeamBackEnd
,
Team
,
EventTeamHandle
Field Summary | |
protected TeamBackEnd |
be
|
Fields inherited from class edu.utah.janosvm.sys.Importable |
em |
Fields inherited from class edu.utah.janosvm.sys.ListNode |
pred, succ |
Constructor Summary | |
|
TeamHandle()
|
protected |
TeamHandle(TeamHandle other)
Copy constructor. |
Method Summary | |
protected void |
bindTo(Exportable ex)
Bind this Importable to the given Exportable. |
void |
cancelImport(Importable im)
|
java.lang.Object |
clone()
Clone a ListNode. |
boolean |
equals(java.lang.Object obj)
|
int |
getDaemonCount()
|
java.lang.String |
getDescription()
Get the Team's description string. |
int |
getID()
Returns the unique integer identifier for the team represented by this handle. |
java.lang.String |
getName()
Get the name of the team associated with this handle. |
int |
getThreadCount()
|
void |
importObject(Importable to,
java.lang.Object id)
|
boolean |
isTerminated()
Test if this handle has been revoked (which is frequently associated with the death of the Team). |
boolean |
owns(java.lang.Object obj)
Test if the given object is "owned" by the team this handle represents. |
(package private) static void |
popReservation(TeamReservation tr)
Pop the last TeamReservation off the stack. |
TeamReservation |
pushReservation()
Create a new reservation that reserves the team this object points to. |
static void |
returnFrom()
End a visit to this team. |
void |
switchTo()
Start a visit from the current team to the team this handle refers to. |
void |
terminate()
Terminate the team referenced by this handle. |
java.lang.String |
toString()
|
protected void |
unbindFrom()
Unbind this Importable from any objects it is referencing. |
Methods inherited from class edu.utah.janosvm.sys.Importable |
copy, finalize, getExportManager, revoke, setExportManager |
Methods inherited from class edu.utah.janosvm.sys.ListNode |
append, inList, prepend, remove |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait, wait0 |
Field Detail |
protected TeamBackEnd be
Constructor Detail |
public TeamHandle()
protected TeamHandle(TeamHandle other)
Method Detail |
protected void bindTo(Exportable ex)
Importable
This method will be invoked as a side-effect of binding this
importable to an Exportable object via 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 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
cancelImport(edu.utah.janosvm.sys.Importable)
,
Team.revokeObject(java.lang.Object)
,
terminate()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String getName()
public java.lang.String getDescription()
public int getID()
public int getThreadCount()
public int getDaemonCount()
public boolean owns(java.lang.Object obj)
Passing null returns true.
obj
- The object to test for ownership.public void terminate()
If the calling thread is owned by the team being terminated, this function will not return.
This method blocks until after the TeamEvent.TERMINATED
events are sent. It may return before the TeamEvent.BURIED
events are sent.
Active visits to the team being terminated will
delay termination until all the visits have been completed.
XXX if there is already a terminate in progress, I think
this will return early.
TeamBackEnd.terminate()
public boolean isTerminated()
To reliably know if a Team is terminated, use an EventTeamHandle
to get a "terminated" or "buried" event.
XXX Perhaps this method should be moved to EventTeamHandle.
public void importObject(Importable to, java.lang.Object id) throws DeadTeamException, TeamEjectionException, NoSuchExportException
public void cancelImport(Importable im)
public TeamReservation pushReservation() throws DeadTeamException
TeamReservation.pop()
is invoked by the current thread.
Unlike a switchTo()
, this call does not
implicitly switch context to the other team. That is
done by invoking TeamReservation.visit()
on the
TeamReservation instance returned by this call.
Unlike switchTo()
when creating a reservation from
the current team to the current Team, termination of the
current Team is delayed until the reservation is
popped.
Never returns null.
See TeamReservation
for an example, and for details
of interaction with memory allocations, throwing exceptions, and
blocking in Object.wait()
.
switchTo()
,
TeamBackEnd.pushReservation(int)
,
TeamReservation.visit()
,
TeamReservation.leave()
public void switchTo() throws DeadTeamException, TeamEjectionException
returnFrom()
is
invoked.
Note that switching to the current Team (i.e., Team.current().switchTo()) does NOT prevent the current Team from being terminated. Perhaps that is a bug.
See TeamReservation
for an example, and for details
of interaction with memory allocations, throwing exceptions, and
blocking in Object.wait()
.
TeamBackEnd.switchTo(int)
public static void returnFrom()
XXX Throws an exception/error if used without a corresponding switchTo?
switchTo()
,
TeamBackEnd.returnFrom()
static void popReservation(TeamReservation tr)
Prefer use of TeamReservation.pop()
.
NOTE: the given tr is just used as a sanity check
to make sure an intervening reservation hasn't been skipped.
public java.lang.Object clone()
ListNode
clone
in class ListNode
public java.lang.String toString()
toString
in class Importable
|
JanosVM v1.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |