|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTrawler
public class Trawler
Manages the emulated nodes. It works by listening for new TCP connections. Each new connecting node sends the UDP port it is using for listening to peers. Also multiple emulated nodes might be running on the same machine so this lets us disambiguate them. The Trawler replies with the fishnet address that the emulated node should use, as well as the current neighbor list for that node aspairs. The trawler updates this list as it changes. Usage: java Trawler [topo file] Topo file is the topology file. It is an optional argument. By default all nodes will be neighbors.
Method Summary | |
---|---|
void |
exit()
Stop the Trawler |
void |
failEdge(int fishAddrA,
int fishAddrB)
An edge was removed. |
void |
failNode(int fishAddr)
A node was removed from the topology. |
static Trawler |
GetInstance()
Static method to get an instance of trawler. |
static Trawler |
GetInstance(int port)
Static method to get an instance of trawler. |
static void |
main(java.lang.String[] args)
Entry point to start Trawler |
void |
remove(EmulatedNode dyingNode)
An emulated node has quit so notify its neighbors |
void |
restartNode(int fishAddr)
A node rejoined the topology, so we add back in all of its edges. |
void |
start(java.lang.String topofile)
Wait for a node to connect, then: find out if any nodes have left while we were waiting (and if so, update their neighbors so they stop sending them packets) find a free fishnet Address to assign to the new node, and send it to them (by writing to the node's TCP socket) find out which UDP port they are listening to (by reading from the node's TCP socket) tell the node about all its neighbors' IP addresses and port #'s tell all their neighbors with their IP address and port # loop |
void |
startEdge(int fishAddrA,
int fishAddrB)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Trawler GetInstance()
public static Trawler GetInstance(int port) throws java.io.IOException
port
- The port the trawler should listen for incoming connections on
java.io.IOException
- If an I/O error occurs when opening the socketpublic void failEdge(int fishAddrA, int fishAddrB)
fishAddrA
- Address of one node of the edgefishAddrB
- Address of the other node of the edgepublic void startEdge(int fishAddrA, int fishAddrB)
public void failNode(int fishAddr)
fishAddr
- Address of the node to be failedpublic void restartNode(int fishAddr)
fishAddr
- Address of node that is restartingpublic void start(java.lang.String topofile) throws java.io.FileNotFoundException, java.lang.Exception
Wait for a node to connect, then: find out if any nodes have left while we were waiting (and if so, update their neighbors so they stop sending them packets) find a free fishnet Address to assign to the new node, and send it to them (by writing to the node's TCP socket) find out which UDP port they are listening to (by reading from the node's TCP socket) tell the node about all its neighbors' IP addresses and port #'s tell all their neighbors with their IP address and port # loop
topofile
- Name of the topology filename. If it is null then all nodes are neighbors by default
java.io.FileNotFoundException
- If the filename could not be found
java.lang.Exception
- Any other exception that might occur while the Trawler is runningpublic void remove(EmulatedNode dyingNode)
dyingNode
- The node that has quitpublic void exit()
public static void main(java.lang.String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |