All Packages  This Package  Class Hierarchy  Class Search  Index

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

  Summary

public final class  Flow
     extends edu.utah.janos.nodeos.pj_Flow
{
          // Fields 2
     FlowClassLoader loader;
     private String name;

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

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

     public void addClass(String, byte[]);
     public void addSystemPackage(String);
     public void allowPackage(String);
     public synchronized void destroy();
     public synchronized boolean destroyed();
     public void enablePackageControls(boolean);
     public String getName();
     pj_Flow getNativeFlow();
     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);
     void start(FlowStartSpec);
     public void threadStart(Runnable, String);
     public String toString();
}

Java wrapper for a flow.

If you know BeOS or V, this is like a "Team". If you prefer Mach (or know what Fluke is), this is similar to a "Task". If all you know is Unix, then think of this as a "process". You might also call it a "resource container" or possibly a "protection domain."

Author:
Janos Ministry of Development


  Cross Reference

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





  Fields

· loader

Summary  |  Top
   FlowClassLoader loader

The Flow ClassLoader for this flow.

This object is allocated and initialized by the flow's FlowInitializer. That is the only reason it isn't final.

The loader also acts as a flag for a destroyed flow. If loader is null, the flow is destroyed. Note that loader is null until the first thread in the new flow is started, so don't rely on destroyed() until the flow actually running.

See Also: run


· name

Summary  |  Top
   private String name


  Constructors

· Flow

Summary  |  Top

   Flow(Flow parent, 
        Credentials cred, 
        ThreadPoolSpec tPoolSpec, 
        MemSpec memSpec, 
        Runnable termHandler) 

Initalize a new Flow. See newFlow(). Does not "start" the flow.



  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. Starts a new thread executing within the new 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 "create()" 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.

Returns:
a FlowHandle onto the new child flow.


· start

Summary  |  Top
   void start(FlowStartSpec flowStartSpec) 

Start a new flow going. This must only be invoked once per flow. It is automatically invoked by the newFlow() method.



· destroy

Summary  |  Top
   public synchronized void destroy() 
Overrides:
destroy in class pj_Flow


· destroyed

Summary  |  Top
   public synchronized boolean destroyed() 


· threadStart

Summary  |  Top
   public void threadStart(Runnable r, 
                           String name) 

Create an explicit thread. This is a new thread which is not subject to whatever concurrency limit this Flow's ThreadPool has. But, it will be scheduled by the ThreadPool's scheduler.

Parameter Description
r the Runnable to start the target thread on.
name the String name of the new thread.

Overrides:
threadStart in class pj_Flow


· getObject

Summary  |  Top
   public Object getObject() 
Overrides:
getObject in class pj_Flow


· setObject

Summary  |  Top
   public void setObject(Object obj) 
Overrides:
setObject in class pj_Flow


· toString

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


· 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



· getNativeFlow

Summary  |  Top
   pj_Flow getNativeFlow() 


· setName

Summary  |  Top
   public void setName(String name) 
Overrides:
setName in class pj_Flow


· getName

Summary  |  Top
   public String getName() 
Overrides:
getName in class pj_Flow


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