All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class magician.Node.ActiveNodeManager

java.lang.Object
   |
   +----magician.Node.ActiveNodeManager

public class ActiveNodeManager
extends Object
implements ExecEnvironment, PerfConstants
The Active Node Manager is the top-level manager of the Active Node. It starts up other entities of the Active Node such as the Resource Manager, Routing Manager and the Event Manager. It also provides some primitives for the user Smartpacket to create and manage small state.

See Also:
ResourceMgr, RoutingMgr, EventManager

Variable Index

 o transmitter

Constructor Index

 o ActiveNodeManager(String, String, String)
Creates a SmartPacketLoader, starts all other managers, requests connection information from InformationServer, and then creates a socket and a new PortManager for each connection.

Method Index

 o CreateGlobalState(String)
creates global state.
 o CreateSmallState(String)
creates small state.
 o DestroyGlobalState(String)
removes global state associated with key
 o DestroySmallState(String)
removes small state associated with key
 o enqueue(KUSmartPacketV2)
enqueues Smartpackets into ready queue
 o GetGlobalState(String)
returns the object stored in the global state associated with given key.
 o GetLinkBandwidthToNode(String)
returns the bandwidth capacity to a neighboring node.
 o getNeighbors()
returns a list of neighbors nodes
 o GetNetName()
Get this node's virtual net name
 o GetNodeName()
Get this node's virtual name
 o GetServices()
Return the list of all services
 o GetSmallState(String)
returns the object stored in the small state associated with given key.
 o GetSmallState(String, long)
returns the object stored in the small state associated with given key.
 o GetTraceOutputStream()
Get this node's trace output stream return an OutputStream for trace output
 o HaveService(String)
Check if a particular service is available
 o Process(byte[])
entry point for executing packets received over the wire
 o Process(String, Object)
entry point for executing packets handed by the sending node
 o ProcessSP(byte[])
well-known entry method to send this environments packets for processing.
 o ProcessSP(String, KUSmartPacketV2)
entry point for executing packets handed by the sending node
 o RegisterService(String, Object)
Register a new service with the ActiveNodeManager.
 o run()
starts up the Node Manager
 o Send(String, Object)
Called by Active nodes that behave as hosts to inject smartpackets
 o SendSmartPacket(String, Object)
called by SmartPacket to send itself to the destination
 o SetGlobalState(String, Object)
sets the contents of the global state
 o SetSmallState(String, Object)
sets the contents of the small state

Variables

 o transmitter
 public static PortInterface transmitter

Constructors

 o ActiveNodeManager
 public ActiveNodeManager(String ourHostId,
                          String ourNetId,
                          String traceOutputName)
Creates a SmartPacketLoader, starts all other managers, requests connection information from InformationServer, and then creates a socket and a new PortManager for each connection.

See Also:
Four11

Methods

 o GetSmallState
 public static Object GetSmallState(String key) throws StateNotFoundException, StateEmptyException
returns the object stored in the small state associated with given key. If the contents of the small state are being accessed by another SmartPacket, then a NoSuchElementException exception is thrown. The normal procedure is to then yield the CPU and try to reacquire the small state.

Parameters:
key - a string identifying the small state
Returns:
contents of the small state
Throws: StateNotFoundException
if the small state associated with the key does not exist
Throws: StateEmptyException
if small state exists but is empty, which is the case when some other SmartPacket is accessing the contents.
 o GetSmallState
 public static Object GetSmallState(String key,
                                    long timeout) throws StateNotFoundException, StateEmptyException
returns the object stored in the small state associated with given key. If the contents of the small state are being accessed by another SmartPacket, then a NoSuchElementException exception is thrown. The normal procedure is to then yield the CPU and try to reacquire the small state.

Parameters:
key - a string identifying the small state
timeout - time period to wait for, else throw StateEmptyException
Returns:
contents of the small state
Throws: StateNotFoundException
if the small state associated with the key does not exist
Throws: StateEmptyException
if small state exists but is empty, which is the case when some other SmartPacket is accessing the contents.
 o SetSmallState
 public static void SetSmallState(String key,
                                  Object stateObj) throws StateNotFoundException
sets the contents of the small state

Parameters:
key - a string identifying the small state
stateObj - the content to be deposited
Throws: StateNotFoundException
if state named by key does not exist
 o CreateSmallState
 public static synchronized void CreateSmallState(String key) throws StateExistsException
creates small state. It is the task of the user to check if small state same name already exists. The small state created by this method is accessible only to SmartPackets of the same type as the one that created it. To share state, use CreateGlobalState() method.

Parameters:
key - a string identifying the small state
Throws: StateExistsException
if state named by given key exists
 o DestroySmallState
 public static void DestroySmallState(String key) throws StateNotFoundException
removes small state associated with key

Parameters:
key - a string identifying the small state
Throws: StateNotFoundException
if named state does not exist
 o GetGlobalState
 public static Object GetGlobalState(String key) throws NullPointerException, NoSuchElementException
returns the object stored in the global state associated with given key. If the contents of the global state are being accessed by another SmartPacket, then a NoSuchElementException exception is thrown. The normal procedure is to then yield the CPU and try to reacquire the global state.

Parameters:
key - a string identifying the global state
Returns:
the contents of the global state
Throws: NullPointerException
if the global state associated with the key does not exist
Throws: NOSuchElementException
if global state exists but is empty, which is the case when some other SmartPacket is accessing the contents.
 o SetGlobalState
 public static void SetGlobalState(String key,
                                   Object stateObj)
sets the contents of the global state

Parameters:
key - a string identifying the global state
stateObj - the content to be deposited
Throws: StateNotFoundException
if the global state associated with the key does not exist
 o CreateGlobalState
 public static synchronized boolean CreateGlobalState(String key)
creates global state. It is the task of the user to check if global state by same name already exists. The state created by this method is accessible to SmartPackets of all types. To create per-type small state, use CreateSmallState() method.

Parameters:
key - a string identifying the global state
 o DestroyGlobalState
 public static void DestroyGlobalState(String key)
removes global state associated with key

Parameters:
key - a string identifying the global state
 o getNeighbors
 public static UnsynchVector getNeighbors()
returns a list of neighbors nodes

Returns:
s a Vector of adjoining neighbor nodes
 o RegisterService
 public static void RegisterService(String ServiceName,
                                    Object Server)
Register a new service with the ActiveNodeManager. Any service can be added. However, it has to be noted that the service is global in scope and can be accessed by Smartpackets of other types.

Parameters:
ServiceName - the name of the service
Server - the object implementing the service
 o GetLinkBandwidthToNode
 public static int GetLinkBandwidthToNode(String nodeName)
returns the bandwidth capacity to a neighboring node.

Parameters:
nodeName - name of the neighboring node
Returns:
the bandwidth in Kbps
 o GetServices
 public static String GetServices()
Return the list of all services

Returns:
the service listing
 o HaveService
 public static Object HaveService(String ServiceName)
Check if a particular service is available

Parameters:
ServiceName - name of the service
Returns:
object implementing service, else null
 o Send
 public boolean Send(String PortName,
                     Object SPObject)
Called by Active nodes that behave as hosts to inject smartpackets

Parameters:
Portname - name of destination active node
SPObject - the SmartPacket object
Returns:
true if transmission was successful, false otherwise
 o SendSmartPacket
 public static boolean SendSmartPacket(String PortName,
                                       Object SPObject)
called by SmartPacket to send itself to the destination

Parameters:
Portname - name of destination active node
SPObject - the SmartPacket object
Returns:
true if transmission was successful, false otherwise
 o GetNodeName
 public static String GetNodeName()
Get this node's virtual name

Returns:
s the node name as a String
 o GetNetName
 public static String GetNetName()
Get this node's virtual net name

Returns:
the net name as a String
 o GetTraceOutputStream
 public static OutputStream GetTraceOutputStream()
Get this node's trace output stream return an OutputStream for trace output

See Also:
OutputStream
 o ProcessSP
 public static void ProcessSP(String destination,
                              KUSmartPacketV2 SPObject)
entry point for executing packets handed by the sending node

Parameters:
destination - the destination of this SmartPacket
SPObject - the executable object
 o Process
 public void Process(String destination,
                     Object SPObject)
entry point for executing packets handed by the sending node

Parameters:
destination - the destination of this SmartPacket
SPObject - the executable object
 o ProcessSP
 public static void ProcessSP(byte packetbytes[])
well-known entry method to send this environments packets for processing. This method accepts the entire packet as a stream of bytes. This is useful when this VM is operating at another site

Parameters:
packetbytes - the stream of bytes comprising the packet
 o enqueue
 protected static void enqueue(KUSmartPacketV2 SPObject)
enqueues Smartpackets into ready queue

Parameters:
SPObject - KU_SmartPacket object
 o Process
 public void Process(byte packetbytes[])
entry point for executing packets received over the wire

Parameters:
packetbytes - the on-the-wire representation of the SmartPacket
 o run
 public void run()
starts up the Node Manager


All Packages  Class Hierarchy  This Package  Previous  Next  Index
1