|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectManager
Abstract class defining generic routines for running network code under Fishnet
Field Summary | |
protected CommandsParser |
parser
|
protected java.io.BufferedReader |
reader
|
protected SortedEventQueue |
sortedEvents
|
Constructor Summary | |
protected |
Manager(long time)
Initialize Manager. |
Method Summary | |
protected void |
addEvent(long timeToOccur,
java.lang.String methodName,
java.lang.Object obj,
java.lang.String[] paramTypes,
java.lang.Object[] params)
|
void |
addTimer(int nodeAddr,
long deltaT,
Callback callback)
Adds a timer to be fired at deltaT milliseconds in the future |
void |
addTimerAt(int nodeAddr,
long t,
Callback callback)
Adds a timer to be fired at time t |
abstract long |
now()
Retrieve current time in milliseconds |
protected long |
readFishFile(long deferTill)
Reads one line of the fish commands file and returns how long to delay further parsing if time command was found Call this function after now > 0 |
abstract boolean |
sendNodeMsg(int nodeAddr,
java.lang.String msg)
Sends the msg to the the specified node |
boolean |
sendPkt(int from,
int to,
byte[] pkt)
Send the pkt to the specified node |
void |
setFishnetFile(java.lang.String filename)
Sets the fishnet file that commands should be read from |
protected void |
setParser(CommandsParser parser)
|
void |
setTimescale(double timescale)
Sets the amount to scale real time by. |
abstract void |
start()
Starts the Manager. |
void |
stop()
Stops Fishnet. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected SortedEventQueue sortedEvents
protected CommandsParser parser
protected java.io.BufferedReader reader
Constructor Detail |
protected Manager(long time)
time
- Starting time in microsecondsMethod Detail |
public abstract void start()
public void stop()
public void setFishnetFile(java.lang.String filename) throws java.io.FileNotFoundException
filename
- The name of the file that commands should be read from
java.io.FileNotFoundException
- If the named filed does not exist, is a directory rather than a regular file, or
for some other reason cannot be opened for readingpublic boolean sendPkt(int from, int to, byte[] pkt) throws java.lang.IllegalArgumentException
from
- The node that is sending the packetto
- Int spefying the destination nodepkt
- The packet to be sent, serialized to a byte array
java.lang.IllegalArgumentException
- If the arguments are invalidpublic void addTimerAt(int nodeAddr, long t, Callback callback)
nodeAddr
- Addr of node that is registering this timert
- The time when the timer should fire. In millisecondscallback
- The callback to be invoked when the timer firespublic void addTimer(int nodeAddr, long deltaT, Callback callback)
nodeAddr
- Addr of node that is registering this timerdeltaT
- The time interval after which the timer should fire. In millisecondscallback
- The callback to be invoked when the timer firespublic abstract long now()
public abstract boolean sendNodeMsg(int nodeAddr, java.lang.String msg)
nodeAddr
- Address of the node to whom the message should be sentmsg
- The msg to send to the node
public void setTimescale(double timescale)
timescale
- The amount to scale real time byprotected void setParser(CommandsParser parser)
protected long readFishFile(long deferTill)
deferTill
- Should be the value returned by this function. Can be initialized to 0 for first invocation
protected void addEvent(long timeToOccur, java.lang.String methodName, java.lang.Object obj, java.lang.String[] paramTypes, java.lang.Object[] params)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |