JanosVM v1.0 API

edu.utah.janosvm.sys
Class Team

java.lang.Object
  |
  +--edu.utah.janosvm.sys.ListNode
        |
        +--edu.utah.janosvm.sys.Importable
              |
              +--edu.utah.janosvm.sys.TeamHandle
                    |
                    +--edu.utah.janosvm.sys.EventTeamHandle
                          |
                          +--edu.utah.janosvm.sys.Team
All Implemented Interfaces:
java.lang.Cloneable

public final class Team
extends EventTeamHandle

Peer object for a TeamBackEnd. An instance of a Team is created inside each team to contain that team's local data. Specifically, this class keeps track of the cross-team references coming from its team. Team objects are never created directly, they are created implicitly as a side-effect of the static method create(edu.utah.janosvm.sys.TeamHandle, java.lang.String, edu.utah.janosvm.resources.ResourceSpec[], kaffe.util.Ptr).

The association with the TeamBackEnd in the kernel team is implicit (through TeamBackEnd.getCurrentTeam()).

Because this class extends TeamHandle, it is importable.

A new Team is entirely passive. No threads are created in the team, nor are any threads required to be created. Threads from some other team must {@linkplain TeamHandle#switchTo visit} the new team and create threads in it, if an active Team is desired. Because a passive Team is perfectly legitimate, Teams do not automatically exit when all non-daemon threads have exited. See notifyOnFinish().

Author:
Tim Stack, Utah Janos Team
See Also:
TeamBackEnd, TeamHandle

Field Summary
private  java.lang.String description
          A description of the contents of the team.
private  TeamHandle kernel
          The cached kernel team handle.
private  java.util.Hashtable locals
          Hashtable for TeamLocals.
private  PortAuthority pa
          The manager of any cross team references.
 
Fields inherited from class edu.utah.janosvm.sys.EventTeamHandle
eventMask, teh
 
Fields inherited from class edu.utah.janosvm.sys.TeamHandle
be
 
Fields inherited from class edu.utah.janosvm.sys.Importable
em
 
Fields inherited from class edu.utah.janosvm.sys.ListNode
pred, succ
 
Constructor Summary
(package private) Team()
           
(package private) Team(ExportManager kernelManager)
          Construct a Team object.
 
Method Summary
 boolean addDependency(TeamHandle th)
          Add a dependency to this team.
static TeamHandle create()
          Create a new team.
static TeamHandle create(ResourceSpec[] specs)
          Create a new team.
static TeamHandle create(java.lang.String name)
          Create a new team.
static TeamHandle create(java.lang.String name, ResourceSpec[] specs)
          Create a new team.
static TeamHandle create(TeamHandle th, ResourceSpec[] specs)
          Create a new team.
static TeamHandle create(TeamHandle th, java.lang.String name, ResourceSpec[] specs)
          Create a new team.
private static TeamHandle create(TeamHandle handle, java.lang.String name, ResourceSpec[] specs, kaffe.util.Ptr nativeSpecs)
           
static Team current()
           
 ExportManager exportAnonymousObject(Exportable ex)
           
 ExportManager exportObject(java.lang.Object id, Exportable ex)
           
static TeamHandle find(java.lang.String name)
          Get a handle on the Team with the given name.
static TeamHandle find(TeamHandle th, java.lang.String name)
          Get a handle on the Team with the given name.
(package private) static TeamHandle find(TeamHandle th, TeamBackEnd be)
           
 java.lang.Object getClassLocal(java.lang.Class cl)
          Get the team-local object associated with the given class in this team.
static java.lang.Object getCurrentClassLocal(java.lang.Class cl)
          Get the team-local object associated with the given class in the current team.
 java.lang.String getDescription()
          Get the Team's description string.
 TeamHandle getKernelTeam()
          Get a handle on the kernel team.
(package private)  java.util.Hashtable getLocals()
           
 PortAuthority getPortAuthority()
          Get the PortAuthority for the current team.
 void notifyOnFinish()
          Set the flag on the team object that indicates that the last non-daemon thread in the team should send out a TeamEvent.FINISHED event when it dies.
 ExportManager reserveExportID(java.lang.Object id)
           
 void revokeAnonymousObject(Exportable ex)
           
 void revokeObject(java.lang.Object id)
          XXX rename to revokeExport
 void sendEvent(int type)
          Send a user-defined event to all EventTeamHandles that are registered to listen for user events.
 void setClassLocal(java.lang.Class cl, java.lang.Object obj)
          Associate the given object with the given class in this team.
static void setCurrentClassLocal(java.lang.Class cl, java.lang.Object obj)
          Associate the given object with the given class in the current team.
 void setDescription(java.lang.String str)
           
(package private)  void setKernelHandle(ExportManager kernelManager)
           
 java.lang.String toString()
           
 
Methods inherited from class edu.utah.janosvm.sys.EventTeamHandle
clone, event, getEventHandler, setEventHandler
 
Methods inherited from class edu.utah.janosvm.sys.TeamHandle
bindTo, cancelImport, equals, getDaemonCount, getID, getName, getThreadCount, importObject, isTerminated, owns, popReservation, pushReservation, returnFrom, switchTo, terminate, unbindFrom
 
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

pa

private final PortAuthority pa
The manager of any cross team references.

locals

private final java.util.Hashtable locals
Hashtable for TeamLocals.

kernel

private final TeamHandle kernel
The cached kernel team handle.

description

private java.lang.String description
A description of the contents of the team.
Constructor Detail

Team

Team()

Team

Team(ExportManager kernelManager)
Construct a Team object.

NOTE: For kernel use only; there is only one of these objects per team.

Method Detail

create

private static TeamHandle create(TeamHandle handle,
                                 java.lang.String name,
                                 ResourceSpec[] specs,
                                 kaffe.util.Ptr nativeSpecs)
                          throws DuplicateExportException,
                                 ResourceSpecException,
                                 DeadTeamException

create

public static TeamHandle create(TeamHandle th,
                                java.lang.String name,
                                ResourceSpec[] specs)
                         throws DuplicateExportException,
                                ResourceSpecException,
                                DeadTeamException
Create a new team. Use the given TeamHandle for the return value, rebinding the handle if necessary. Give the team the given name (in its export table), and setup the given resource specifications in the new team. Any of the parameters may be null. A new TeamHandle will be allocated if null is passed for th.
Returns:
a TeamHandle on the new team.

create

public static TeamHandle create(java.lang.String name,
                                ResourceSpec[] specs)
                         throws DuplicateExportException,
                                ResourceSpecException,
                                DeadTeamException
Create a new team. Equivalent to Team.create(null, name, specs).

create

public static TeamHandle create(TeamHandle th,
                                ResourceSpec[] specs)
                         throws ResourceSpecException,
                                DeadTeamException
Create a new team. Equivalent to Team.create(th, null, specs).

create

public static TeamHandle create(java.lang.String name)
                         throws DuplicateExportException,
                                ResourceSpecException,
                                DeadTeamException
Create a new team. Equivalent to Team.create(null, name, null).

create

public static TeamHandle create(ResourceSpec[] specs)
                         throws ResourceSpecException,
                                DeadTeamException
Create a new team. Equivalent to Team.create(null, null, specs).

create

public static TeamHandle create()
                         throws ResourceSpecException,
                                DeadTeamException
Create a new team. Equivalent to Team.create(null, null, null).

current

public static Team current()
Returns:
The Team object for the current team.

find

public static TeamHandle find(TeamHandle th,
                              java.lang.String name)
                       throws DeadTeamException,
                              TeamEjectionException,
                              NoSuchExportException
Get a handle on the Team with the given name. TeamHandles with the null name cannot be found this way.
Parameters:
th - The TeamHandle to initialize.
name - The name of the TeamHandle to locate.
Returns:
The given TeamHandle th, or null
Throws:
NoSuchExportException - if name is null or empty

find

public static TeamHandle find(java.lang.String name)
                       throws DeadTeamException,
                              TeamEjectionException,
                              NoSuchExportException
Get a handle on the Team with the given name. TeamHandles with the null name cannot be found this way.
Parameters:
name - The name of the TeamHandle to locate.
Returns:
A TeamHandle object that imports the TeamBackEnd with the given name.
Throws:
NoSuchExportException - if name is null or empty

find

static TeamHandle find(TeamHandle th,
                       TeamBackEnd be)

setKernelHandle

void setKernelHandle(ExportManager kernelManager)

setDescription

public void setDescription(java.lang.String str)
Parameters:
str - A string that describes this team.

getDescription

public java.lang.String getDescription()
Description copied from class: TeamHandle
Get the Team's description string.
Overrides:
getDescription in class TeamHandle
Returns:
A string that describes this team.

getKernelTeam

public TeamHandle getKernelTeam()
Get a handle on the kernel team.
Returns:
The cached kernel Team handle.

getPortAuthority

public PortAuthority getPortAuthority()
Get the PortAuthority for the current team.
Returns:
The PortAuthority for the current team.

reserveExportID

public ExportManager reserveExportID(java.lang.Object id)
                              throws DuplicateExportException
See Also:
PortAuthority.reserveExportID(java.lang.Object)

exportObject

public ExportManager exportObject(java.lang.Object id,
                                  Exportable ex)
                           throws DuplicateExportException
See Also:
PortAuthority.exportObject(java.lang.Object, edu.utah.janosvm.sys.Exportable)

revokeObject

public void revokeObject(java.lang.Object id)
                  throws NoSuchExportException
XXX rename to revokeExport

exportAnonymousObject

public ExportManager exportAnonymousObject(Exportable ex)

revokeAnonymousObject

public void revokeAnonymousObject(Exportable ex)
                           throws NoSuchExportException

getLocals

java.util.Hashtable getLocals()
Returns:
The local data for the current team.

setClassLocal

public void setClassLocal(java.lang.Class cl,
                          java.lang.Object obj)
Associate the given object with the given class in this team.
Parameters:
cl - The class the object should be stored with.
obj - The object to store with the class.
See Also:
getClassLocal(java.lang.Class), setCurrentClassLocal(java.lang.Class, java.lang.Object)

setCurrentClassLocal

public static void setCurrentClassLocal(java.lang.Class cl,
                                        java.lang.Object obj)
Associate the given object with the given class in the current team.
Parameters:
cl - The class the object should be stored with.
obj - The object to store with the class.
See Also:
getCurrentClassLocal(java.lang.Class), setClassLocal(java.lang.Class, java.lang.Object)

getClassLocal

public java.lang.Object getClassLocal(java.lang.Class cl)
Get the team-local object associated with the given class in this team.
Parameters:
cl - The class to retrieve the local object for.
Returns:
The object associated with the class or null.
See Also:
getCurrentClassLocal(java.lang.Class), setClassLocal(java.lang.Class, java.lang.Object)

getCurrentClassLocal

public static java.lang.Object getCurrentClassLocal(java.lang.Class cl)
Get the team-local object associated with the given class in the current team.
Parameters:
cl - The class to retrieve the local object for.
Returns:
The object associated with the class or null.
See Also:
getClassLocal(java.lang.Class), setCurrentClassLocal(java.lang.Class, java.lang.Object)

addDependency

public boolean addDependency(TeamHandle th)
Add a dependency to this team.
Parameters:
th - The team this one should depend on.
Returns:
True if the addition succeeded, false otherwise.

notifyOnFinish

public void notifyOnFinish()
Set the flag on the team object that indicates that the last non-daemon thread in the team should send out a TeamEvent.FINISHED event when it dies. By registering an TeamEventHandler with this Team, termination-on-last-non-daemon-thread-exiting semantics can be achived by terminating the team when that event is received.
See Also:
TeamEvent, EventTeamHandle

sendEvent

public void sendEvent(int type)
Send a user-defined event to all EventTeamHandles that are registered to listen for user events.
Parameters:
type - must be one of TeamEvent.USER1, TeamEvent.USER2, or TeamEvent.USER3

toString

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

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