All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tos.Shell

java.lang.Object
   |
   +----java.lang.Thread
           |
           +----tos.Shell

public final class Shell
extends Thread
Objects of this class represents runtime context of carriers. All shells are daemon threads and will cease to exist when there are no more non-daemon threads executing within the JVM.

Note: Starting several shells in parallel for the same carrier is not a good idea. The main reason is that the shells will update the same path object.

Version:
$Id: Shell.java,v 1.7 2000/11/16 15:35:10 lauvset Exp $
Author:
Kåre Jørgen Lauvset [kaare@cs.uit.no]
See Also:
Carrier, Loader

Constructor Index

 o Shell(Carrier)
Create client side shell.

Method Index

 o current()
Get current shell.
 o loader()
Get loader.
 o run()
Execute carrier context.
 o status()
Get shell/carrier exit status.

Constructors

 o Shell
 public Shell(Carrier ca)
Create client side shell. The following code example shows a typical way of using the client side shell, where <carrier> is an instantiated and initialized carrier:
   new Shell(<carrier>).start();
 
The carrier is transferred to the host given in the first element of its path, where it is executed by the local TOS runtime system.

Parameters:
ca - Carrier to launch.
See Also:
Carrier

Methods

 o status
 public Exception status()
Get shell/carrier exit status. This method should be called after the shell has exited. Furthermore, calling the method from the carrier that runs in the actual shell does not make any sense.

Returns:
Shell/carrier exit status.
 o current
 public static Shell current()
Get current shell. This method should be called from running carriers. The current shell could also be retrieved as follows:
   Shell sh = (Shell)Thread.currentThread();
 

Returns:
Current shell.
 o loader
 public Loader loader()
Get loader. This method return the loader which defines the name space for the carrier that runs within the shell. A carrier can also retrieve its loader as follows:
   Loader ld = (Loader)getClass().getClassLoader();
 

Returns:
Shell loader.
See Also:
Loader
 o run
 public void run()
Execute carrier context. This method is executed when the shell is started.

Overrides:
run in class Thread

All Packages  Class Hierarchy  This Package  Previous  Next  Index