JanosVM v0.6.0 Java API

edu.utah.janosvm.sys
Class TeamBackEnd

java.lang.Object
  |
  +--edu.utah.janosvm.sys.Exportable
        |
        +--edu.utah.janosvm.sys.TeamBackEnd

class TeamBackEnd
extends Exportable

Kernel class used to represent a team, this is then extended internally with a nativeClass. The class is an Exportable since all instances of TeamBackEnd are allocated in the kernel team. The team they represent has a Team instance associated with the TeamBackEnd.

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

Field Summary
private static int _versionMajor
           
private static int _versionMinor
           
private static java.lang.String _versionName
          Version info.
private  boolean dying
          Indicates whether or not the team is being terminated.
private static ExportManager kernelManager
           
static java.lang.String kernelName
           
private static TeamBackEnd kernelTeam
          Reference to the kernel team.
private  java.lang.String name
           
private  Team peer
          The object local to the team's heap that contains per-team state specific to that team.
(package private) static TeamListBackEnd teamList
           
 
Fields inherited from class edu.utah.janosvm.sys.Exportable
anonManager, owner
 
Constructor Summary
private TeamBackEnd()
          Constructor used for the kernel team.
(package private) TeamBackEnd(java.lang.String name, ResourceSpec[] specs, kaffe.util.Ptr nativeSpecs)
          Create a user team with the given name and resources.
 
Method Summary
 boolean addDependency(TeamBackEnd dep)
          Add a dependency to this team.
private  void anchorObject(java.lang.Object obj)
          Anchor an object so the collector doesn't free it.
 void buriedTeamEvent(int teamId)
          Called from native code by reaper after it completes the burial of a team.
private static void doTheReap()
          Kernel reaper thread's entry into native code.
 void finishTeamEvent(int teamId)
           
private  void floatObject(java.lang.Object obj)
          Float a previously anchored object.
 java.lang.Object getClassLocal(java.lang.Class cl)
           
static java.lang.Object getCurrentClassLocal(java.lang.Class cl)
           
(package private) static TeamBackEnd getCurrentTeam()
          Get the TeamBackEnd associated with the current thread.
(package private)  int getID()
          Get the unique integer identifier for this team.
(package private) static TeamBackEnd getKernelTeam()
           
 java.lang.String getName()
           
(package private) static TeamBackEnd getObjectOwner(java.lang.Object obj)
           
(package private)  Team getPeer()
          Gets the Team peer associated with this TeamBackEnd.
private  int nativeConstructor(java.lang.String name, ResourceSpec[] specs, kaffe.util.Ptr nativeSpecs)
          Constructs the native part of the class.
private  void nativeTerminate()
          Native level terminate code
 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.
(package private)  boolean owns(java.lang.Object obj)
          Tests to see if an object is owned by this team.
(package private) static void popReservation()
          Pop the last TeamReservation off the stack.
(package private)  TeamReservation pushReservation()
           
(package private)  TeamReservation pushReservation(int wrapCount)
           
(package private) static void returnFrom()
          End a visit and return to the previous team.
 void setClassLocal(java.lang.Class cl, java.lang.Object obj)
          Store a per-team class local object.
static void setCurrentClassLocal(java.lang.Class cl, java.lang.Object obj)
           
(package private)  void setDescription(java.lang.String desc)
           
(package private)  boolean switchTo()
          Basic visit wrapper provided for code that operates directly on TeamBackEnds.
(package private)  boolean switchTo(int wrapCount)
          Start a visit.
(package private)  void terminate()
          Terminate this team, revoke all its exports, kill its threads and return its resources to the system.
 java.lang.String toString()
           
 
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

_versionName

private static final java.lang.String _versionName
Version info.

_versionMajor

private static final int _versionMajor

_versionMinor

private static final int _versionMinor

kernelTeam

private static TeamBackEnd kernelTeam
Reference to the kernel team.

kernelManager

private static ExportManager kernelManager

teamList

static TeamListBackEnd teamList

kernelName

public static final java.lang.String kernelName

dying

private boolean dying
Indicates whether or not the team is being terminated.

peer

private Team peer
The object local to the team's heap that contains per-team state specific to that team. Specifically, it contains the tables of items exported from the team.

name

private java.lang.String name
Constructor Detail

TeamBackEnd

private TeamBackEnd()
Constructor used for the kernel team.

TeamBackEnd

TeamBackEnd(java.lang.String name,
            ResourceSpec[] specs,
            kaffe.util.Ptr nativeSpecs)
      throws DuplicateResourceSpecException,
             IndexedResourceSpecException,
             DeadTeamException
Create a user team with the given name and resources. This is the internal version that can be used by the native code to construct a team with native resource specifications.
Parameters:
name - The name of the team.
specs - The specifications required by the team.
nativeSpecs - Native array of resource specifications.
Throws:
Throws - a DuplicateResourceSpecException if the specs array contains more than one ResourceSpec for the same resource.
Throws - an IndexedResourceSpecException if the one of the ResourceSpec's couldn't be satisfied.
Method Detail

getKernelTeam

static TeamBackEnd getKernelTeam()
Returns:
The kernel TeamBackEnd object.

getPeer

Team getPeer()
Gets the Team peer associated with this TeamBackEnd.
Returns:
The peer object.

getName

public java.lang.String getName()
Returns:
The name of the team.

nativeConstructor

private int nativeConstructor(java.lang.String name,
                              ResourceSpec[] specs,
                              kaffe.util.Ptr nativeSpecs)
                       throws DuplicateResourceSpecException
Constructs the native part of the class.
Parameters:
name - The name of this team.
specs - The resources specifications for the team.
Returns:
The index of the ResourceSpec that couldn't be satisfied.

owns

boolean owns(java.lang.Object obj)
Tests to see if an object is owned by this team. (Ownership is defined as paying for the memory used by the object instance.)
Parameters:
obj - The object to test for ownership.
Returns:
True if this TeamBackEnd owns the given object.

getObjectOwner

static TeamBackEnd getObjectOwner(java.lang.Object obj)

switchTo

boolean switchTo(int wrapCount)
           throws TeamEjectionException
Start a visit. A visit is completed with a matching call to returnFrom().
Parameters:
wrapCount - Indicates the number of wrapper functions around this one. This is required so that we can record where visit take place and can properly back out of them if an exception is thrown.
Returns:
Whether the visit was successful or not.
See Also:
returnFrom()

switchTo

boolean switchTo()
           throws TeamEjectionException
Basic visit wrapper provided for code that operates directly on TeamBackEnds.
Returns:
Whether the visit was successful or not.

returnFrom

static void returnFrom()
End a visit and return to the previous team.

XXX this shouldn't be static. Just to make the symmetry a bit more apparent, if nothing else. Also would be a bit easier to add sanity checking code with a this pointer.


getCurrentTeam

static TeamBackEnd getCurrentTeam()
Get the TeamBackEnd associated with the current thread. This returns whatever team the thread is currently executing in (i.e., during a visit), and is not necessairly the home team of the thread.
Returns:
The team that this thread is currently running in.

getID

int getID()
Get the unique integer identifier for this team. Identifiers are uniquie among currently executing teams, but may be re-used when a team is destroyed. (Analogous to a "PID" in unix.)
Returns:
The unique integer identifier for this team.

setDescription

void setDescription(java.lang.String desc)
Parameters:
desc - A description of the contents of this team.

anchorObject

private void anchorObject(java.lang.Object obj)
Anchor an object so the collector doesn't free it. The object becomes a "root" in the collector so the collector will never free it. The object must be explicitly un-anchored before it will be freed.
See Also:
floatObject(Object)

floatObject

private void floatObject(java.lang.Object obj)
Float a previously anchored object. The object will be reclaimed when it is unreachable.
See Also:
anchorObject(Object)

doTheReap

private static void doTheReap()
Kernel reaper thread's entry into native code. It never comes back.

finishTeamEvent

public void finishTeamEvent(int teamId)

buriedTeamEvent

public void buriedTeamEvent(int teamId)
Called from native code by reaper after it completes the burial of a team.

nativeTerminate

private void nativeTerminate()
Native level terminate code

terminate

void terminate()
Terminate this team, revoke all its exports, kill its threads and return its resources to the system.

If the calling thread is part of the team being terminated then this function will not return.

Note that termination is delayed by any active visits from other teams, so to provide quick termination all visits must be "short".


pushReservation

TeamReservation pushReservation(int wrapCount)
                          throws DeadTeamException
Parameters:
wrapCount - Indicates the number of wrapper functions around this one. This is required so that we can record where pushes take place and can properly back out of them if an exception is thrown.
Returns:
A TeamReservation object that reserves this team.

pushReservation

TeamReservation pushReservation()
                          throws DeadTeamException

popReservation

static void popReservation()
Pop the last TeamReservation off the stack.

setClassLocal

public void setClassLocal(java.lang.Class cl,
                          java.lang.Object obj)
Store a per-team class local object.
Parameters:
cl - The class the object should be stored with.
obj - The object to store with the class.

setCurrentClassLocal

public static void setCurrentClassLocal(java.lang.Class cl,
                                        java.lang.Object obj)

getClassLocal

public java.lang.Object getClassLocal(java.lang.Class cl)
Parameters:
cl - The class to retrieve the local object for.
Returns:
The Object associated with the class or null.

getCurrentClassLocal

public static java.lang.Object getCurrentClassLocal(java.lang.Class cl)

addDependency

public boolean addDependency(TeamBackEnd dep)
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.

toString

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

JanosVM v0.6.0 Java API

This documentation is Copyright (C) 2000-2002 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 Mar 17, 2002