Rice Pastry API

rice.pastry.standard
Class StandardJoinProtocol

java.lang.Object
  extended by rice.pastry.client.PastryAppl
      extended by rice.pastry.standard.StandardJoinProtocol
All Implemented Interfaces:
JoinProtocol
Direct Known Subclasses:
ConsistentJoinProtocol

public class StandardJoinProtocol
extends PastryAppl
implements JoinProtocol

An implementation of a simple join protocol. Overview: initiateJoin() causes InitiateJoinMsg to be sent periodically on the joiner causes handleInitiateJoin() constructs a RouteMessage(JoinRequest) and sends it to the boostrap causes handleIntermediateHop() on each node along the route causes respondToJoiner() on last hop causes completeJoin() on joiner

Version:
$Id: StandardJoinProtocol.java 4222 2008-05-26 09:14:30Z jeffh $
Author:
Peter Druschel, Andrew Ladd, Rongmei Zhang, Y. Charlie Hu, Jeff Hoye

Nested Class Summary
static class StandardJoinProtocol.SJPDeserializer
           
 
Field Summary
protected  ScheduledMessage joinEvent
           
protected  LeafSet leafSet
           
protected  NodeHandle localHandle
           
protected  RoutingTable routeTable
           
 
Fields inherited from class rice.pastry.client.PastryAppl
address, deserializer, instance, logger, options, receiver, thePastryNode
 
Constructor Summary
StandardJoinProtocol(PastryNode ln, NodeHandle lh, RoutingTable rt, LeafSet ls)
          Constructor.
StandardJoinProtocol(PastryNode ln, NodeHandle lh, RoutingTable rt, LeafSet ls, MessageDeserializer md)
           
 
Method Summary
 void broadcastRows(JoinRequest jr)
          Broadcasts the route table rows.
protected  void completeJoin(JoinRequest jr)
          called on the joiner
 boolean deliverWhenNotReady()
          We always want to receive messages.
 int getAddress()
          Get address.
protected  void getJoinRequest(NodeHandle bootstrap, Continuation<JoinRequest,java.lang.Exception> deliverJRToMe)
           
protected  java.util.Map<java.lang.String,java.lang.Object> getOptions(JoinRequest jr, java.util.Map<java.lang.String,java.lang.Object> existing)
           
protected  void handleInitiateJoin(InitiateJoin ij)
           
protected  void handleIntermediateHop(RouteMessage rm)
           
protected  void handleJoinRequest(JoinRequest jr)
           
 void initiateJoin(java.util.Collection<NodeHandle> bootstrap)
           
 void messageForAppl(Message msg)
          Should not be called becasue we are overriding the receiveMessage() interface anyway.
 void receiveMessage(Message msg)
          Receives a message from the outside world.
protected  void respondToJoiner(JoinRequest jr)
           
protected  void setReady()
          Can be overloaded to do additional things before going ready.
 
Methods inherited from class rice.pastry.client.PastryAppl
accept, canReceiveSocket, connect, destroy, enrouteMessage, finishReceiveSocket, getDeserializer, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, leafSetChange, notifyReady, receiveMessageInternal, register, routeMsg, routeMsg, routeMsgDirect, routeSetChange, setDeserializer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localHandle

protected NodeHandle localHandle

routeTable

protected RoutingTable routeTable

leafSet

protected LeafSet leafSet

joinEvent

protected ScheduledMessage joinEvent
Constructor Detail

StandardJoinProtocol

public StandardJoinProtocol(PastryNode ln,
                            NodeHandle lh,
                            RoutingTable rt,
                            LeafSet ls)
Constructor.

Parameters:
lh - the local node handle.
sm - the Pastry security manager.

StandardJoinProtocol

public StandardJoinProtocol(PastryNode ln,
                            NodeHandle lh,
                            RoutingTable rt,
                            LeafSet ls,
                            MessageDeserializer md)
Method Detail

getAddress

public int getAddress()
Get address.

Overrides:
getAddress in class PastryAppl
Returns:
gets the address.

initiateJoin

public void initiateJoin(java.util.Collection<NodeHandle> bootstrap)
Specified by:
initiateJoin in interface JoinProtocol

receiveMessage

public void receiveMessage(Message msg)
Receives a message from the outside world.

Overrides:
receiveMessage in class PastryAppl
Parameters:
msg - the message that was received.

handleInitiateJoin

protected void handleInitiateJoin(InitiateJoin ij)

getJoinRequest

protected void getJoinRequest(NodeHandle bootstrap,
                              Continuation<JoinRequest,java.lang.Exception> deliverJRToMe)

handleIntermediateHop

protected void handleIntermediateHop(RouteMessage rm)

handleJoinRequest

protected void handleJoinRequest(JoinRequest jr)

respondToJoiner

protected void respondToJoiner(JoinRequest jr)

getOptions

protected java.util.Map<java.lang.String,java.lang.Object> getOptions(JoinRequest jr,
                                                                      java.util.Map<java.lang.String,java.lang.Object> existing)

completeJoin

protected void completeJoin(JoinRequest jr)
called on the joiner


setReady

protected void setReady()
Can be overloaded to do additional things before going ready. For example, verifying that other nodes are aware of us, so that consistent routing is guaranteed.


broadcastRows

public void broadcastRows(JoinRequest jr)
Broadcasts the route table rows.

Parameters:
jr - the join row.

messageForAppl

public void messageForAppl(Message msg)
Should not be called becasue we are overriding the receiveMessage() interface anyway.

Specified by:
messageForAppl in class PastryAppl
Parameters:
msg - the message that is arriving.

deliverWhenNotReady

public boolean deliverWhenNotReady()
We always want to receive messages.

Overrides:
deliverWhenNotReady in class PastryAppl
Returns:
false unless the node is a service

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection