All Packages Class Hierarchy This Package Previous Next Index
Class magician.Node.KUSmartPacketV2
java.lang.Object
|
+----magician.Node.KUSmartPacketV2
- public abstract class KUSmartPacketV2
- extends Object
- implements Runnable, Serializable
This is the base class for all communication in the active network. Any
new SmartPacket that the user creates must extend this class.
This class represents the interface to the node resources. All access to
node resources are governed through this class. In this release, access to
small state at an active node is not governed through this class. Use
ActiveNodeManager.CreateSmallState(), ActiveNodeManager.GetSmallState(),
and ActiveNodeManager.SetSmallState() primitives for such access.
However, it must be noted that those primitives will be rolled in with this
interface in the next release.
SmartPackets that are derived directly from this class are not guaranteed
reliable communication. To use reliable communication, use ReliableCommFW class.
This class provides the entry point for all user code. The user code must be
inserted by overriding the exec() method of this class. If one wishes
to build a complex protocol hierarchy before the user code is executed, the
build() method must be overridden with the appropriate framework code.
See ReliableCommFW for an example of a framework implementing reliable
communication.
- See Also:
- ReliableCommFW
-
CPU_Requirements
- the cpu cycles required by htis packet (currently ignored)
-
Destination_Address
- name of destination active node
-
halted
-
-
IO_BW_Requirements
- the network bandwidth requirements in bits/second (not used)
-
MAX_RETRIES
- number of retries to get next hop from routing method
-
Memory_Requirements
- the memory in bytes consumed by this packet during execution (currently not recorded)
-
NextHop
- name of next hop active node
-
PacketID
- Packet ID, used by ActiveNodeManager to track packet
-
Source_Address
- name of source active node
-
thisNode
-
-
TypeID
- the type identifier for this Smartpacket.
-
KUSmartPacketV2()
-
-
AcquireSmallState(String)
- synchronously acquires small state
-
build()
- interface that is to be used to build frameworks beyond the basic
unreliable delivery provided by this class
-
CreateSmallState(String)
- enables small state to be created by user packet
-
describeComponents(Field[], ObjectOutputStream)
- describes the components of the type class to the serilaized stream
This is called by user frameworks that are derived from this class
to describe related components that form the same type
-
DestroySmallState(String)
- destroys previously created small state
-
exec()
- this method is overridden by user to implement user logic
-
GetCanonicalAddress(String)
- returns the canonical name of the active node if it exists,
else returns the gateway node from which the node can be
reached
-
getExecTime()
-
-
getExecTime2()
-
-
getExecTime3()
-
-
GetLinkLayerAddress(String)
- gives the base address of the active node, default is IP address
-
getMyKcc()
-
-
getMyUcc()
-
-
GetNetName()
- gives the name of the network to which this node belongs
-
GetNextHop()
- returns the name of the active node that is the next hop towards the
destination
-
GetNodeName()
- gives the name of this active node
-
GetNumberOfHops(String)
- gives the number of hops required to reach a
particular node from this node
-
getPid()
-
-
getPidCc(int)
-
-
getPidKcc(int)
-
-
getPidUcc(int)
-
-
GetService(String)
- returns a service registered at the active node
-
GetSmallState(String)
- synchronously acquires small state
-
GetSmallState(String, long)
- synchronously acquires small state but user can specify maximum time period
-
getSourceAddress()
- gives the name of the active node from which this Smartpacket
was sent
-
getStime(int)
-
-
getTypeId()
- returns the type identifier for the SmartPacket
-
getUtime(int)
-
-
halt()
-
-
pathNotFound()
- called when node cannot find route to destination
-
run()
- method called by Node to execute the Smartpacket
-
SendForProcessing(String)
- To be used when smartpacket is expected
to execute at this node
-
SendSmartPacket()
- sends this Smartpacket towards destination
-
SendSmartPacket(String)
- To be used when packet is to be sent directly without
execution at the local node
-
SetSmallState(String, Object)
- sets the contents of the named small state
-
setTflag(int)
-
-
sleep(long)
- sleep for specified amount of time
-
stop()
- stops execution of SmartPacket
-
tagB()
-
-
tagE()
-
-
yield()
- relinquish the CPU
CPU_Requirements
protected long CPU_Requirements
- the cpu cycles required by htis packet (currently ignored)
Memory_Requirements
protected int Memory_Requirements
- the memory in bytes consumed by this packet during execution (currently not recorded)
IO_BW_Requirements
protected int IO_BW_Requirements
- the network bandwidth requirements in bits/second (not used)
Source_Address
protected String Source_Address
- name of source active node
Destination_Address
public String Destination_Address
- name of destination active node
PacketID
protected transient int PacketID
- Packet ID, used by ActiveNodeManager to track packet
NextHop
protected transient String NextHop
- name of next hop active node
MAX_RETRIES
static final int MAX_RETRIES
- number of retries to get next hop from routing method
TypeID
protected byte TypeID[]
- the type identifier for this Smartpacket.
thisNode
protected transient String thisNode
halted
protected transient boolean halted
KUSmartPacketV2
public KUSmartPacketV2()
tagE
public native void tagE()
tagB
public native void tagB()
getMyUcc
public native long getMyUcc()
getMyKcc
public native long getMyKcc()
getPidUcc
public native long getPidUcc(int thePid)
getPidKcc
public native long getPidKcc(int thePid)
getUtime
public native long getUtime(int thePid)
getStime
public native long getStime(int thePid)
getPidCc
public native long getPidCc(int thePid)
getPid
public native int getPid()
setTflag
public native void setTflag(int pid)
getExecTime2
public long getExecTime2()
getExecTime3
public long getExecTime3()
getExecTime
public long getExecTime()
run
public final void run()
- method called by Node to execute the Smartpacket
getTypeId
public byte[] getTypeId()
- returns the type identifier for the SmartPacket
- Returns:
- byte array representing the type identifier
getSourceAddress
public String getSourceAddress()
- gives the name of the active node from which this Smartpacket
was sent
- Returns:
- a string representing the name of the source node
GetCanonicalAddress
public String GetCanonicalAddress(String nodeName)
- returns the canonical name of the active node if it exists,
else returns the gateway node from which the node can be
reached
- Parameters:
- nodeName - the name of the Active Node
- Returns:
- name of active node, if it exists, else name of gateway node
GetLinkLayerAddress
public String GetLinkLayerAddress(String nodeName)
- gives the base address of the active node, default is IP address
- Parameters:
- name - of the active node
- Returns:
- a string representing base address of active node
GetNodeName
public String GetNodeName()
- gives the name of this active node
- Returns:
- string respresenting name of this node
GetNetName
public String GetNetName()
- gives the name of the network to which this node belongs
- Returns:
- String representing network name
GetService
public Object GetService(String service)
- returns a service registered at the active node
- Parameters:
- service - name of the service
- Returns:
- object representing service if it exists, else null
GetNextHop
public String GetNextHop()
- returns the name of the active node that is the next hop towards the
destination
- Returns:
- name of active node
GetNumberOfHops
public int GetNumberOfHops(String node) throws NoRouteToHostException
- gives the number of hops required to reach a
particular node from this node
- Returns:
- number of hops required
- Throws: NoRouteToHostException
- if no route exists
SendSmartPacket
public void SendSmartPacket()
- sends this Smartpacket towards destination
SendSmartPacket
public void SendSmartPacket(String destination)
- To be used when packet is to be sent directly without
execution at the local node
- Parameters:
- destination - the name of the destination active node
SendForProcessing
public void SendForProcessing(String destination)
- To be used when smartpacket is expected
to execute at this node
- Parameters:
- destination - the ultimate destination of the packet
build
public void build()
- interface that is to be used to build frameworks beyond the basic
unreliable delivery provided by this class
- See Also:
- ReliableCommFW
exec
public void exec()
- this method is overridden by user to implement user logic
describeComponents
protected void describeComponents(Field components[],
ObjectOutputStream out) throws IOException
- describes the components of the type class to the serilaized stream
This is called by user frameworks that are derived from this class
to describe related components that form the same type
- Parameters:
- components - an array of Field objects that describe related classes
- out - ObjectOutputStream that is provided by WriteObject method during
serialization
- Throws: IOException
- if object cannot be serialized
stop
protected void stop()
- stops execution of SmartPacket
halt
protected void halt()
sleep
protected void sleep(long time)
- sleep for specified amount of time
- Parameters:
- time - amount of time to sleep
yield
protected void yield()
- relinquish the CPU
CreateSmallState
protected void CreateSmallState(String SSName) throws StateExistsException
- enables small state to be created by user packet
- Parameters:
- SSName - name identifier of small state
GetSmallState
protected Object GetSmallState(String SSName) throws StateNotFoundException, StateEmptyException
- synchronously acquires small state
- Parameters:
- SSName - name identifier of small state
- Returns:
- Object stored in small state
- Throws: StateNotFoundException
- if named small state does not exist
- Throws: StateEmptyException
- if state exists but is empty
GetSmallState
protected Object GetSmallState(String SSName,
long timeout) throws StateNotFoundException, StateEmptyException
- synchronously acquires small state but user can specify maximum time period
- Parameters:
- SSName - name identifier of small state
- Returns:
- Object stored in small state
- Throws: StateNotFoundException
- if named small state does not exist
- Throws: StateEmptyException
- if state exists but is empty
AcquireSmallState
protected Object AcquireSmallState(String SSName) throws StateNotFoundException
- synchronously acquires small state
- Parameters:
- SSName - name identifier of small state
- Returns:
- Object stored in small state
- Throws: StateNotFoundException
- thrown if named small state does not exist
SetSmallState
protected void SetSmallState(String SSName,
Object value) throws StateNotFoundException
- sets the contents of the named small state
- Parameters:
- SSName - name identifier of small state
- value - contents to be placed
- Throws: StateNotFoundException
- if named small state is not found
DestroySmallState
protected void DestroySmallState(String SSName) throws StateNotFoundException
- destroys previously created small state
- Parameters:
- SSName - name identifier of small state
pathNotFound
protected void pathNotFound()
- called when node cannot find route to destination
All Packages Class Hierarchy This Package Previous Next Index