org.objectweb.proactive.p2p.service.node
Class P2PNodeLookup

java.lang.Object
  extended byorg.objectweb.proactive.p2p.service.node.P2PNodeLookup
All Implemented Interfaces:
Active, EndActive, InitActive, P2PConstants, RunActive, java.io.Serializable

public class P2PNodeLookup
extends java.lang.Object
implements InitActive, RunActive, EndActive, P2PConstants, java.io.Serializable

Author:
Alexandre di Costanzo Created on Jan 18, 2005
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.objectweb.proactive.p2p.service.util.P2PConstants
MAX_NODE, P2P_NODE_NAME, PROPERPY_XML_PATH, PROPERTY_ACQUISITION, PROPERTY_BOOKING_MAX, PROPERTY_BOOKING_NODES, PROPERTY_EXPLORING_MSG, PROPERTY_LOOKUP_FREQ, PROPERTY_MSG_MEMORY, PROPERTY_MULTI_PROC_NODES, PROPERTY_NOA, PROPERTY_NODES_ACQUISITION_T0, PROPERTY_PORT, PROPERTY_TTL, PROPERTY_TTU, SHARED_NODE_NAME, VN_NAME
 
Constructor Summary
P2PNodeLookup()
           
P2PNodeLookup(java.lang.Integer numberOfAskedNodes, P2PService localP2pService, P2PAcquaintanceManager acquaintances, java.lang.String vnName, java.lang.String jobId)
           
 
Method Summary
 boolean allArrived()
          Check if all asked nodes are arrived.
 void endActivity(Body body)
          Remove this nodes accessor from the waiting node accessors list in the local P2P service.
 java.util.Vector getAndRemoveNodes()
           
 void giveNode(Node givenNode, P2PNodeManager remoteNodeManager)
          Receipt a reference to a shared node.
 void initActivity(Body body)
          Initializes the activity of the active object.
 boolean isActive()
          Returns whether the node accessor is active or not.
 void killAllNodes()
          Kill all received node.
 void killNode(java.lang.String node)
          Kill the given node.
 void moveTo(java.lang.String nodeUrl)
          Migrate the P2P node lookup tyo a new node.
 boolean nArrived(int n)
          Check if n nodes are arrived.
 void reservingNodes(java.util.Vector nodesToBook)
          Reserve nodes for a later use.
 void runActivity(Body body)
          Runs the activity of the active object.
 void wakeUp()
          Wake up the active object, to send asking node message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

P2PNodeLookup

public P2PNodeLookup()

P2PNodeLookup

public P2PNodeLookup(java.lang.Integer numberOfAskedNodes,
                     P2PService localP2pService,
                     P2PAcquaintanceManager acquaintances,
                     java.lang.String vnName,
                     java.lang.String jobId)
Method Detail

allArrived

public boolean allArrived()
Check if all asked nodes are arrived. false for asking all available nodes.

Returns:
true if all asked nodes are arrived, false else.

nArrived

public boolean nArrived(int n)
Check if n nodes are arrived.

Parameters:
n - number of needed nodes.
Returns:
true if n nodes are available, false

killNode

public void killNode(java.lang.String node)
Kill the given node.

Parameters:
node - the node url to kill.

killAllNodes

public void killAllNodes()

Kill all received node.

Warning: if nodes are removed from the Collection, these nodes will be not kill.


wakeUp

public void wakeUp()
Wake up the active object, to send asking node message.


giveNode

public void giveNode(Node givenNode,
                     P2PNodeManager remoteNodeManager)
Receipt a reference to a shared node.

Parameters:
givenNode - the shared node.
remoteNodeManager - the remote node manager for the given node.

isActive

public boolean isActive()

Returns whether the node accessor is active or not. The nodes accessor is active as long as it has an associated thread running to serve the requests by calling methods on the active object and looking for asked nodes.

If the nodes accessor is not active, looking for nodes is stopped.

Returns:
whether the nodes accessor is active or not.

getAndRemoveNodes

public java.util.Vector getAndRemoveNodes()
Returns:
all available and node and remove them from the lookup.

reservingNodes

public void reservingNodes(java.util.Vector nodesToBook)

Reserve nodes for a later use.

This method creates dummy active objects in the nodes.

Parameters:
nodesToBook - nodes to book.

moveTo

public void moveTo(java.lang.String nodeUrl)
Migrate the P2P node lookup tyo a new node.

Parameters:
nodeUrl - the URL of the destination node.

initActivity

public void initActivity(Body body)
Description copied from interface: InitActive
Initializes the activity of the active object.

Specified by:
initActivity in interface InitActive
Parameters:
body - the body of the active object being initialized
See Also:
InitActive.initActivity(org.objectweb.proactive.Body)

runActivity

public void runActivity(Body body)
Description copied from interface: RunActive
Runs the activity of the active object.

Specified by:
runActivity in interface RunActive
Parameters:
body - the body of the active object being started
See Also:
RunActive.runActivity(org.objectweb.proactive.Body)

endActivity

public void endActivity(Body body)
Remove this nodes accessor from the waiting node accessors list in the local P2P service.

Specified by:
endActivity in interface EndActive
Parameters:
body - the body of the active object being finalized.
See Also:
EndActive.endActivity(org.objectweb.proactive.Body)


Copyright ? April 2005 INRIA All Rights Reserved.