|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectp2pMapReduce.impl.networkModule.jxta.JxtaNetworkModule
public class JxtaNetworkModule
Field Summary | |
---|---|
static long |
ADV_EXPIRATION_TIME
Limited adv expiration time to automatically remove older version on remote node cache Note:The #PUBLISH_TIMEOUT must be less than this value to allow
others node to discovery and update ADV before they expired |
static java.lang.String |
ADV_EXPIRATION_TIME_ATTR
Key for ADV_EXPIRATION_TIME |
static long |
ADV_LIFE_TIME
Limited adv life time in local cache to automatically remove older version. |
static java.lang.String |
ADV_LIFE_TIME_ATTR
Key for ADV_LIFE_TIME |
static java.lang.String |
ADV_LIFETIME_ATTR
Key for ADV_LIFE_TIME |
static java.lang.String |
DEFAULT_PEER_NAME
Default peer name |
static long |
DIRECT_FIND_WAITING_TIME
Time to wait before terminate a direct ADV discovery |
static java.lang.String |
DIRECT_FIND_WAITING_TIME_ATTR
Key for DIRECT_FIND_WAITING_TIME |
static long |
GROUP_FIND_WAITING_TIME
Time to wait for group discovery |
static java.lang.String |
GROUP_FIND_WAITING_TIME_ATTR
Key for GROUP_FIND_WAITING_TIME |
static java.lang.String |
GROUP_ID
Pre-set P2PMapReduce group ID |
static java.lang.String |
IS_GATEWAY_ATTR
Key for is.gateway attribute of the NetworkConfiguration |
static java.lang.String |
JXTA_HOME_ATTR
Key for JXTA home directory attribute in NetworkConfiguration |
static java.lang.String |
JXTA_PEER_MODE_ATTR
Key for JXTA peer mode attribute in NetworkConfiguration |
static java.lang.String |
P2P_MAPREDUCE_GROUP_NAME
P2PMapReduce group name |
static long |
PERIODIC_FIND_TIMEOUT
Deprecated. |
static java.lang.String |
PERIODIC_FIND_TIMEOUT_ATTR
Deprecated. |
static long |
PERIODIC_PUBLISH_TIMEOUT
The time period to publish a new ADV for this node |
static java.lang.String |
PERIODIC_PUBLISH_TIMEOUT_ATTR
Key for #PUBLISH_TIMEOUT |
static java.lang.String |
RDV_AUTO_START
Key for rdv.autoStart attribute of the NetworkConfiguration |
static java.lang.String |
RDV_SEEDS_ATTR
Key for rdv.seeds attribute of the NetworkConfiguration |
static long |
RDV_WAITING_TIME
Time to wait for RDV connection |
static java.lang.String |
RDV_WAITING_TIME_ATTR
Key for RDV_WAITING_TIME |
Constructor Summary | |
---|---|
JxtaNetworkModule(NetworkConfiguration networkConfiguration)
|
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 |
boolean |
connectedOrRDV(net.jxta.peergroup.PeerGroup pg)
|
protected void |
connectionClosed(NodeInfo connectionEndPoint)
|
NodeInfo |
find(java.lang.String nodeID)
Search the network to find the NodeAdvertisement of the node identified by nodeID |
java.util.Collection<JxtaBidiPipeConnection> |
getActiveConnection()
|
protected java.util.Set<NodeInfo> |
getAllAvailableNodes(java.util.Set<net.jxta.document.Advertisement> resp)
|
java.util.Set<NodeInfo> |
getAllAvailableNodesFromLocalCache()
TODO public for testing purpose. to make not public |
java.util.Set<NodeInfo> |
getAllAvailableNodesFromLocalCache(int nodeType)
Returns the set of all available node info for those nodes which role is nodeType . |
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()
Retrieves all the node adv on the network and for each peer keeps only the node adv with higher version //XXX for now we see in the local cache becouse if this is a rdv |
protected java.util.Set<NodeInfo> |
getAllNodesFromLocalCache()
Deprecated. use getAllAvailableNodesFromLocalCache() instead |
java.util.Set<NodeInfo> |
getAllSlaves()
Return all the visible slave nodes in the network by this network module at the moment |
JxtaNodeInfo |
getAvailableNodeFromLocalCache(java.lang.String nodeID)
Try to find the most recent available version of the node info for the node which id is nodeID . |
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 |
net.jxta.peergroup.PeerGroup |
getNetPeerGroup()
|
net.jxta.platform.NetworkManager |
getNetworkManager()
|
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 |
net.jxta.peergroup.PeerGroup |
getP2pMapReduceGroup()
|
boolean |
isAlive(java.lang.String nodeID)
Indicate if a node is alive. |
NodeInfo |
joinNetwork()
Call this method once to enter the P2PMapReduce network. |
protected void |
nodeFailure(NodeInfo failedNodeInfo)
|
void |
publish()
Used to send the information of the NodeInfo instance associated to this network module across the P2PMapReduce network. |
protected void |
putConnection(java.lang.String nodeID,
JxtaBidiPipeConnection conn)
|
protected JxtaBidiPipeConnection |
removeConnection(java.lang.String nodeID)
|
void |
rendezvousEvent(net.jxta.rendezvous.RendezvousEvent event)
|
void |
send(NodeInfo endPoint,
java.io.Serializable o)
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 senderID,
java.io.Serializable msg)
Send the object msg to the node identified by destID . |
void |
setNodeModule(NodeModuleIF nodeModule)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String GROUP_ID
public static final java.lang.String P2P_MAPREDUCE_GROUP_NAME
public static final java.lang.String DEFAULT_PEER_NAME
public static final java.lang.String JXTA_HOME_ATTR
NetworkConfiguration
public static final java.lang.String JXTA_PEER_MODE_ATTR
NetworkConfiguration
public static final java.lang.String GROUP_FIND_WAITING_TIME_ATTR
GROUP_FIND_WAITING_TIME
public static final long GROUP_FIND_WAITING_TIME
public static final java.lang.String ADV_LIFETIME_ATTR
ADV_LIFE_TIME
public static final long ADV_LIFE_TIME
#PUBLISH_TIMEOUT
must be less than this value to allow
others node to discovery and update ADV before they expired
public static final java.lang.String ADV_LIFE_TIME_ATTR
ADV_LIFE_TIME
public static final java.lang.String ADV_EXPIRATION_TIME_ATTR
ADV_EXPIRATION_TIME
public static final long ADV_EXPIRATION_TIME
#PUBLISH_TIMEOUT
must be less than this value to allow
others node to discovery and update ADV before they expired
public static final java.lang.String PERIODIC_PUBLISH_TIMEOUT_ATTR
#PUBLISH_TIMEOUT
public static final long PERIODIC_PUBLISH_TIMEOUT
public static final java.lang.String PERIODIC_FIND_TIMEOUT_ATTR
PERIODIC_FIND_TIMEOUT
public static final long PERIODIC_FIND_TIMEOUT
public static final java.lang.String DIRECT_FIND_WAITING_TIME_ATTR
DIRECT_FIND_WAITING_TIME
public static final long DIRECT_FIND_WAITING_TIME
public static final java.lang.String RDV_WAITING_TIME_ATTR
RDV_WAITING_TIME
public static final long RDV_WAITING_TIME
public static final java.lang.String IS_GATEWAY_ATTR
is.gateway
attribute of the NetworkConfiguration
public static final java.lang.String RDV_SEEDS_ATTR
rdv.seeds
attribute of the NetworkConfiguration
public static final java.lang.String RDV_AUTO_START
rdv.autoStart
attribute of the NetworkConfiguration
Constructor Detail |
---|
public JxtaNetworkModule(NetworkConfiguration networkConfiguration)
Method Detail |
---|
public NodeInfo joinNetwork()
NetworkModuleIF
NetworkModuleIF.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
joinNetwork
in interface NetworkModuleIF
public FTPManager getFtpManager()
NetworkModuleIF
getFtpManager
in interface NetworkModuleIF
public void becomeSlave()
NetworkModuleIF
becomeSlave
in interface NetworkModuleIF
public void becomeMaster()
NetworkModuleIF
becomeMaster
in interface NetworkModuleIF
public void publish()
NetworkModuleIF
publish
in interface NetworkModuleIF
public NodeInfo getNodeInfo()
NetworkModuleIF
getNodeInfo
in interface NetworkModuleIF
public NodeModuleIF getNodeModule()
NetworkModuleIF
NodeModuleIF
associated to this network module
getNodeModule
in interface NetworkModuleIF
public void setNodeModule(NodeModuleIF nodeModule)
setNodeModule
in interface NetworkModuleIF
public void addEventListener(EventListener eventListener)
NetworkModuleIF
EventListener
to which forward all the
MessageEvent
received by the network connections
addEventListener
in interface NetworkModuleIF
public NodeInfo find(java.lang.String nodeID)
nodeID
find
in interface NetworkModuleIF
nodeID
-
public boolean isAlive(java.lang.String nodeID)
isAlive
in interface NetworkModuleIF
nodeID
-
NetworkModuleIF.find(String)
public int getNumMasters()
NetworkModuleIF
getNumMasters
in interface NetworkModuleIF
public int getNumSlaves()
NetworkModuleIF
getNumSlaves
in interface NetworkModuleIF
public int getNumNodes()
NetworkModuleIF
getNumNodes
in interface NetworkModuleIF
public java.util.Set<NodeInfo> getAllSlaves()
NetworkModuleIF
getAllSlaves
in interface NetworkModuleIF
public java.util.Set<NodeInfo> getAllMasters()
NetworkModuleIF
getAllMasters
in interface NetworkModuleIF
public java.util.Set<NodeInfo> getAllNodes()
getAllNodes
in interface NetworkModuleIF
public java.util.Set<NodeInfo> getOtherSlaves()
NetworkModuleIF
getOtherSlaves
in interface NetworkModuleIF
public java.util.Set<NodeInfo> getOtherMasters()
NetworkModuleIF
getOtherMasters
in interface NetworkModuleIF
public net.jxta.platform.NetworkManager getNetworkManager()
public net.jxta.peergroup.PeerGroup getNetPeerGroup()
public net.jxta.peergroup.PeerGroup getP2pMapReduceGroup()
public java.util.Collection<JxtaBidiPipeConnection> getActiveConnection()
protected java.util.Set<NodeInfo> getAllNodesFromLocalCache()
getAllAvailableNodesFromLocalCache()
instead
public java.util.Set<NodeInfo> getAllAvailableNodesFromLocalCache()
public java.util.Set<NodeInfo> getAllAvailableNodesFromLocalCache(int nodeType)
nodeType
.
XXX In order to avoid the possibility of collect obsolete node info, a
preliminary search of all node info is done to collect the most recent
node info for a node.
After only the node info of the specified type are returned
nodeType
-
protected java.util.Set<NodeInfo> getAllAvailableNodes(java.util.Set<net.jxta.document.Advertisement> resp)
public JxtaNodeInfo getAvailableNodeFromLocalCache(java.lang.String nodeID)
nodeID
.
nodeID
-
public void send(NodeInfo endPoint, java.io.Serializable o) throws java.io.IOException
NetworkModuleIF
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
send
in interface NetworkModuleIF
java.io.IOException
public void send(java.lang.String senderID, java.io.Serializable msg) throws java.io.IOException
NetworkModuleIF
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.
send
in interface NetworkModuleIF
java.io.IOException
public ConnectionIF getConnection(NodeInfo connectionEndPoint) throws java.io.IOException
NetworkModuleIF
connectionEndPoint
getConnection
in interface NetworkModuleIF
java.io.IOException
public ConnectionIF getConnection(java.lang.String nodeID) throws java.io.IOException
NetworkModuleIF
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.
getConnection
in interface NetworkModuleIF
java.io.IOException
protected void putConnection(java.lang.String nodeID, JxtaBidiPipeConnection conn)
protected JxtaBidiPipeConnection removeConnection(java.lang.String nodeID)
protected void nodeFailure(NodeInfo failedNodeInfo)
protected void connectionClosed(NodeInfo connectionEndPoint)
public void rendezvousEvent(net.jxta.rendezvous.RendezvousEvent event)
rendezvousEvent
in interface net.jxta.rendezvous.RendezvousListener
public boolean connectedOrRDV(net.jxta.peergroup.PeerGroup pg)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |