JanosVM v0.6.0 Java API Documentation: Class Importable
JanosVM v0.6.0 Java API

Class Importable

Direct Known Subclasses:
CommHashtableHandle, CommQueuePuller, CommQueuePusher, CommSpaceHandle, FaxPortHandle, TeamHandle, TeamList

public abstract class Importable
extends ListNode

An Importable is a safe, cross-process reference to a remote "Exportable" object.

Methods on Importable and subclasses of Importable may store pointers in a remote process. Beware that getting these operations wrong can create bogus pointers into remote heaps. Such problems generally manifest as the VM crashing.

Example of a 'Foo' and 'FooRef'.

 // The "server" object that other Teams will have references to
 class FooBackEnd extends Exportable {

 // The "client" object that Teams have locally as a reference to the
 // "server"s Foo.
 class FooHandle extends Importable {
   private FooBackEnd be;

   private FooHandle() { } 

   protected void bindTo(Exportable ex)
   { = (FooBackEnd)ex;

   protected void unbindFrom()
   { = null;

   // Lookup a FooBackEnd in the given team.
   public static FooHandle lookupFoo(Team team, Object id) {
     FooBackEnd be;
     FooHandle fh = new FooHandle();
     team.importObject(fh, id);
     return fh;

   // Create an anonymous FooBackEnd and import it into the current team.
   public static FooHandle newFoo(Team team) {
     FooHandle retval = new FooHandle();

       FooBackEnd be = new FooBackEnd();
       ExportManager em;

       em = Team.current().exportAnonymousObject(be);
     return retval;

   // perform an operation via the foo handle on the foo back end
   public void performOp(...) {
     synchronized(this) {
       // do some stuff in the context of current team

       // do some stuff in the context of the owner
In the above example, a FooHandle is bound to a particular Team's FooBackEnd object by looking the object up with some sort of key. Operations on the remote foo are perfomed by invoking performOp() on the FooRef. Internally this function visits the owner of the actual Foo, and performs the operation.

Note that all of the ops are done in a synchronized block on the importable. This will prevent the remote team from revoking the FooHandle while the operation is being performed on it (unless the operation in question is to destroy the Foo... be careful).

Tim Stack, Utah Janos Team
See Also:
TeamHandle.switchTo(), Exportable

Fields inherited from class edu.utah.janosvm.sys.ListNode
pred, succ
Constructor Summary
          Construct an empty Importable.
Method Summary
protected abstract  void bindTo(Exportable ex)
          Bind this Importable to the given Exportable.
protected  void copy(Importable im)
          Copy the reference of the given Importable.
protected  void finalize()
 void revoke()
 java.lang.String toString()
protected abstract  void unbindFrom()
          Unbind this Importable from any objects its referencing.
Methods inherited from class edu.utah.janosvm.sys.ListNode
append, clone, prepend, remove
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public Importable()
Construct an empty Importable.
Method Detail


protected abstract void bindTo(Exportable ex)
Bind this Importable to the given Exportable. The most common implementation of this method would be to cast the Exportable to the type that the Importable subclass handles and store it in the object as well as any other handy pointers/values.
ex - The Exportable that is being imported.


protected abstract void unbindFrom()
Unbind this Importable from any objects its referencing. The most common implementation of this method would be null out any object references in this object.


protected void copy(Importable im)
Copy the reference of the given Importable.
im - The Importable to copy the reference from.


public void revoke()


protected void finalize()
finalize in class java.lang.Object


public java.lang.String toString()
toString in class ListNode

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:
Generated on Mar 17, 2002