JNodeOS v1.2.0 API

edu.utah.janos.nodeos
Class Flow

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

public final class Flow
extends edu.utah.janos.nodeos.pj_Flow

Java wrapper for a flow. This is the current flow's local interface to its own flow object.

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

Method Summary
 void addClass(java.lang.String name, byte[] bytecode)
          Add a new class to an existing flow.
 void addSystemPackage(java.lang.String name)
          Add a package to the list of "system" packages.
static Flow currentFlow()
          Get the current flow.
 void destroy()
          Start flow shutdown/cleanup for this flow.
 boolean destroyed()
           
 void enableAccessControls(boolean doit)
          Enable access controls on the class loader.
 void exportClass(java.lang.String name)
          Export a class from the class loader to the flow.
 java.lang.String getName()
           
 java.lang.Object getObject()
           
 void getStats(FlowStats fs)
           
 java.lang.Class loadClass(java.lang.String name)
           
static java.lang.String lookupConfig(java.lang.String section, java.lang.String tag)
          Lookup something in the JanosVM config file.
static java.lang.String lookupConfig(java.lang.String section, java.lang.String tag, int instance)
          Lookup something in the JanosVM config file.
 FlowHandle newFlow(Credentials cred, ThreadPoolSpec tPoolSpec, MemSpec memSpec, FlowStartSpec flowStartSpec, java.lang.Runnable termHandler)
           
 FlowHandle newFlow(Credentials cred, ThreadPoolSpec tPoolSpec, MemSpec memSpec, FlowStartSpec flowStartSpec, java.lang.Runnable termHandler, FlowClassSpec fcs)
          Create a new Flow, which is a child of the current Flow.
static byte[] readByteCode(java.lang.String classname)
          XXX Is this evil? Should it just be loadFile from class path? XXX should never return null.
 void sealPackage(java.lang.String name)
          Seal a package so that no other classes can be added to it.
 void setName(java.lang.String name)
           
 void setObject(java.lang.Object obj)
           
 void threadStart(java.lang.Runnable r, java.lang.String name)
          Create an explicit thread.
 java.lang.String toString()
          Return a fragment of an id string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

newFlow

public FlowHandle newFlow(Credentials cred,
                          ThreadPoolSpec tPoolSpec,
                          MemSpec memSpec,
                          FlowStartSpec flowStartSpec,
                          java.lang.Runnable termHandler,
                          FlowClassSpec fcs)
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.

XXX don't overload Runnable for the termHandler. Use a different, jnodeos interface that doesn't overlap with the other callback interfaces.

Parameters:
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.

newFlow

public FlowHandle newFlow(Credentials cred,
                          ThreadPoolSpec tPoolSpec,
                          MemSpec memSpec,
                          FlowStartSpec flowStartSpec,
                          java.lang.Runnable termHandler)

destroy

public void destroy()
Start flow shutdown/cleanup for this flow. Unregisters flow from the global FlowRegistry.

destroyed

public boolean destroyed()

threadStart

public void threadStart(java.lang.Runnable r,
                        java.lang.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.
Parameters:
r - the Runnable to start the target thread on.
name - the String name of the new thread.

getObject

public java.lang.Object getObject()

setObject

public void setObject(java.lang.Object obj)

toString

public java.lang.String toString()
Description copied from class: edu.utah.janos.nodeos.pj_Flow
Return a fragment of an id string. Flow.toString() will wrap this
Overrides:
toString in class edu.utah.janos.nodeos.pj_Flow

addClass

public void addClass(java.lang.String name,
                     byte[] bytecode)
Add a new class to an existing flow.

addSystemPackage

public void addSystemPackage(java.lang.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.


sealPackage

public void sealPackage(java.lang.String name)
Seal a package so that no other classes can be added to it.
Parameters:
name - The name of the package to seal.

exportClass

public void exportClass(java.lang.String name)
Export a class from the class loader to the flow.
Parameters:
name - The name of the class to export.

enableAccessControls

public void enableAccessControls(boolean doit)
Enable access controls on the class loader.

loadClass

public java.lang.Class loadClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException

readByteCode

public static byte[] readByteCode(java.lang.String classname)
                           throws java.lang.ClassNotFoundException
XXX Is this evil? Should it just be loadFile from class path? XXX should never return null.

getStats

public void getStats(FlowStats fs)

lookupConfig

public static java.lang.String lookupConfig(java.lang.String section,
                                            java.lang.String tag,
                                            int instance)
Lookup something in the JanosVM config file. XXX This is a hack to make it easy to get config parameters.

lookupConfig

public static java.lang.String lookupConfig(java.lang.String section,
                                            java.lang.String tag)
Lookup something in the JanosVM config file. XXX

currentFlow

public static final Flow currentFlow()
Get the current flow. The current Flow is the flow associated with the current Thread.

setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()

JNodeOS v1.2.0 API

This documentation is Copyright (C) 1998-2002 The University of Utah. All Rights Reserved. See the file LICENSE for distribution terms.
Documentation, software, and mailing list archives for Janos can be found at the Janos Project web site: http://www.cs.utah.edu/flux/janos/
Generated on Mar 17, 2002