All Packages  This Package  Class Hierarchy  Class Search  Index

Class edu.utah.janos.nodeos.Flow
java.lang.Object
   |
   +----edu.utah.janos.nodeos.Flow

  Summary

public final class  Flow
     extends java.lang.Object
{
          // Fields 10
     private final Vector channels;
     private final Credentials cred;
     FlowRun flowRun;
     FlowClassLoader loader;
     private final MemSpec memSpec;
     private String name;
     private Object obj;
     private final Flow parentFlow;
     final FlowState state;
     private final ThreadPool tPool;

          // Constructors 1
     Flow(Flow, Credentials, ThreadPoolSpec, MemSpec, FlowStartSpec);

          // Methods 17
     public static final Flow currentFlow();

     void addChannel(CutThroughChannel);
     void addChannel(InChannel);
     void addChannel(OutChannel);
     public void addClass(String, byte[]);
     public void addSystemPackage(String);
     public void allowPackage(String);
     public void destroy();
     public void enablePackageControls(boolean);
     public String getName();
     public Object getObject();
     public Class loadClass(String) throws ClassNotFoundException;
     public FlowHandle newFlow(Credentials, ThreadPoolSpec, MemSpec, FlowStartSpec, Runnable);
     public void setName(String);
     public void setObject(Object);
     public ThreadPool threadPool();
     public String toString();
}

Java wrapper for a flow. A flow is the closest approximation to a process in Janos.

XXX: A lot of this will have to change so that starting a Flow starts a new process (somehow).

Author:
Janos Ministry of Development


  Cross Reference

Returned By:
FlowRegister.findFlow(), Flow.currentFlow(), ThreadPool.getFlow(), Thread.getFlow(), TestMain.getRootFlow()





  Fields

· cred

Summary  |  Top
   private final Credentials cred

The credentials provided when this Flow was created. This is the bucket from which the Flow gets to extract resources and access Node facilities.


· tPool

Summary  |  Top
   private final ThreadPool tPool

A ThreadPool to be used for Flow-specific actions, mostly just initialization and termination handling.


· memSpec

Summary  |  Top
   private final MemSpec memSpec

The Memory limit for this flow.


· channels

Summary  |  Top
   private final Vector channels

Channels created in this Flow. This list only exists so that the channels can be cleanly destroyed when the flow is terminated.


· parentFlow

Summary  |  Top
   private final Flow parentFlow

The parent flow of this flow. Used for handling termination requests.

XXX this is a cross-process pointer and must be treated specially.


· obj

Summary  |  Top
   private Object obj

A per-flow Object that user code can set and get. (for associating things with the flow).


· loader

Summary  |  Top
   FlowClassLoader loader

The Flow ClassLoader for this flow.

This object is allocated and initialized by the flow's run() method. Thus it isn't final.

See Also: run


· state

Summary  |  Top
   final FlowState state

Per-flow data.


· flowRun

Summary  |  Top
   FlowRun flowRun


· name

Summary  |  Top
   private String name


  Constructors

· Flow

Summary  |  Top

   Flow(Flow parent, 
        Credentials cred, 
        ThreadPoolSpec tPoolSpec, 
        MemSpec memSpec, 
        FlowStartSpec flowStartSpec) 

Initalize a new Flow. See newFlow().

XXX implicitly starts threads. Gak.



  Methods

· newFlow

Summary  |  Top
   public FlowHandle newFlow(Credentials cred, 
                             ThreadPoolSpec tPoolSpec, 
                             MemSpec memSpec, 
                             FlowStartSpec flowStartSpec, 
                             Runnable termHandler) 

Create a new Flow, which is a child of the current Flow.

This is the only interface for creating a Flow.

The termHandler will be invoked by a thread in the parent Flow's if the child Flow is terminated. This handler has a short limit for execution.

If termHandler is null, then no termination handler is called.

XXX Should be called "createFlow()" to sync back with NodeOS spec.

Parameter Description
cred The principal associated with this Flow
tPoolSpec The specification for the new Flow's ThreadPool
memSpec The memory limit for this flow
flowStartSpec Class loading and startup information
termHandler Termination handler invoked by the NodeOS when an immediate child flow is being terminated.



· destroy

Summary  |  Top
   public void destroy() 


· addChannel

Summary  |  Top
   void addChannel(InChannel c) 


· addChannel

Summary  |  Top
   void addChannel(OutChannel c) 


· addChannel

Summary  |  Top
   void addChannel(CutThroughChannel c) 


· getObject

Summary  |  Top
   public Object getObject() 


· setObject

Summary  |  Top
   public void setObject(Object obj) 


· threadPool

Summary  |  Top
   public ThreadPool threadPool() 


· toString

Summary  |  Top
   public String toString() 
Overrides:
toString in class Object


· addClass

Summary  |  Top
   public void addClass(String name, 
                        byte[] bytecode) 

Add a new class to an existing flow.



· addSystemPackage

Summary  |  Top
   public void addSystemPackage(String name) 

Add a package to the list of "system" packages. System packages will be loaded by the system class loader. All other classes will be loaded by the per-flow classloader.

All sub-flows *share* the same definition of "system" packages for now. This is because only one EE System is loaded on the NodeOS. This will have to change.

Implicitly allows the package.



· allowPackage

Summary  |  Top
   public void allowPackage(String pkgPrefix) 

Allow access to a Java package. Must be invoked in the context of this flow.

addLocalPackage implicitly allows those packages, so addPackage need not be called on those packages.

Allowed packages that are not local are either dynamically loaded over the net, or are found locally.



· enablePackageControls

Summary  |  Top
   public void enablePackageControls(boolean doit) 


· loadClass

Summary  |  Top
   public Class loadClass(String name)  throws ClassNotFoundException


· currentFlow

Summary  |  Top
   public static final Flow currentFlow() 

Get the current flow. The current Flow is the flow associated with the current Thread.

See Also: getFlow



· setName

Summary  |  Top
   public void setName(String name) 


· getName

Summary  |  Top
   public String getName() 


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7