|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface NetworkModuleIF
A NetworkModuleIF is the manager of all the network interaction of the node
in the P2PMapReduce framework.
It gives a way to:
- join the P2PMapReduce network
- search the network for some nodes
- obtain connections between nodes
- obtain an FTPManager
Method Summary | |
---|---|
void |
addEventListener(EventListener eventListener)
Used to add a EventListener to which forward all the
MessageEvent received by the network connections |
void |
becomeMaster()
Invoked by the node module to notify that the node has changed its role from Slave to Master |
void |
becomeSlave()
Invoked by the node module to notify that the node has changed its role from Master to Slave |
NodeInfo |
find(java.lang.String nodeID)
Perform a search in the network for the NodeInfo of the node identified by nodeID |
java.util.Set<NodeInfo> |
getAllMasters()
Return all the visible master nodes in the network by this network module at the moment |
java.util.Set<NodeInfo> |
getAllNodes()
Return all the visible nodes in the network by this network module at the moment |
java.util.Set<NodeInfo> |
getAllSlaves()
Return all the visible slave nodes in the network by this network module at the moment |
ConnectionIF |
getConnection(NodeInfo connectionEndPoint)
Returns a connection between this network module and the network module relative to the node described by the NodeInfo connectionEndPoint |
ConnectionIF |
getConnection(java.lang.String nodeID)
Returns a connection between this network module and the network module relative to the node identified by nodeID . |
FTPManager |
getFtpManager()
Return an FTPManager for this node |
NodeInfo |
getNodeInfo()
Return the same instance of NodeInfo returned by the joinNetwork() method. |
NodeModuleIF |
getNodeModule()
Returns the NodeModuleIF associated to this network module |
int |
getNumMasters()
Returns the number of all the visible master nodes from this network module at the moment |
int |
getNumNodes()
Returns the number of all the visible nodes from this network module at the moment |
int |
getNumSlaves()
Returns the number of all the visible slave nodes from this network module at the moment |
java.util.Set<NodeInfo> |
getOtherMasters()
Return all the visible slaves nodes in the network by this network module at the moment, except this node if it is a master |
java.util.Set<NodeInfo> |
getOtherSlaves()
Return all the visible slaves nodes in the network by this network module at the moment, except this node if it is a slave |
boolean |
isAlive(java.lang.String nodeID)
Indicate if the node identified by 'nodeID' is alive. |
NodeInfo |
joinNetwork()
Call this method once to enter the P2PMapReduce network. |
void |
publish()
Used to send the information of the NodeInfo instance associated to this network module across the P2PMapReduce network. |
void |
send(NodeInfo endPoint,
java.io.Serializable msg)
Send the object msg to the node specified by endPoint
If no connection is already available to this node, try to create a new
one using the provided NodeInfo |
void |
send(java.lang.String destID,
java.io.Serializable msg)
Send the object msg to the node identified by destID . |
void |
setNodeModule(NodeModuleIF nodeModule)
|
Method Detail |
---|
NodeInfo joinNetwork()
getNodeInfo()
.
All the updates to the node information will affect this NodeInfo instance.
It also:
- publishes this NodeInfo by calling publish()
- make this NetworkModule capable to receive remote connection from other nodes.
- starts an FTP server
NodeInfo getNodeInfo()
FTPManager getFtpManager()
void publish()
void becomeSlave()
void becomeMaster()
int getNumMasters()
int getNumSlaves()
int getNumNodes()
NodeInfo find(java.lang.String nodeID)
nodeID
nodeID
-
boolean isAlive(java.lang.String nodeID)
nodeID
-
find(java.lang.String)
find(String)
java.util.Set<NodeInfo> getAllNodes()
java.util.Set<NodeInfo> getAllSlaves()
java.util.Set<NodeInfo> getAllMasters()
java.util.Set<NodeInfo> getOtherSlaves()
java.util.Set<NodeInfo> getOtherMasters()
void send(NodeInfo endPoint, java.io.Serializable msg) throws java.io.IOException
msg
to the node specified by endPoint
If no connection is already available to this node, try to create a new
one using the provided NodeInfo
endPoint
- msg
-
java.io.IOException
void send(java.lang.String destID, java.io.Serializable msg) throws java.io.IOException
msg
to the node identified by destID
.
If no connection is already available to this node, try to retrieve the
NodeInfo for this node and to create a new connection.
destID
- msg
-
java.io.IOException
ConnectionIF getConnection(NodeInfo connectionEndPoint) throws java.io.IOException
connectionEndPoint
connectionEndPoint
-
java.io.IOException
ConnectionIF getConnection(java.lang.String nodeID) throws java.io.IOException
nodeID
.
If no connection is already available to this node try to retrieve the
NodeInfo for this node and to create a new connection.
IOException is thrown instead or in consequence of errors.
connectionEndPoint
-
java.io.IOException
NodeModuleIF getNodeModule()
NodeModuleIF
associated to this network module
void setNodeModule(NodeModuleIF nodeModule)
void addEventListener(EventListener eventListener)
EventListener
to which forward all the
MessageEvent
received by the network connections
eventListener
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |