Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rice.pastry.standard
Class ConsistentJoinProtocol

    java.lang.Object
      rice.pastry.client.PastryAppl
          rice.pastry.standard.StandardJoinProtocol
              rice.pastry.standard.ConsistentJoinProtocol

All Implemented Interfaces:
  java.util.Observer, JoinProtocol, NodeSetListener, LoopObserver

    public class ConsistentJoinProtocol

extends StandardJoinProtocol
implements java.util.Observer, NodeSetListener, LoopObserver

Does not setReady until contacting entire leafset which gossips new members. Provides consistency as long as checkLiveness() never incorrectly reports a node faulty. Based on MSR-TR-2003-94. The difference is that our assumption that checkLiveness() is much stronger because we are using DSR rather than checking ourself. Another difference is that we are unwilling to pull nodes from our leafset without checkingLiveness() ourself.

Author:
  Jeff Hoye

Field Summary
`protected int` | `MAX_NUM_TO_HEAR_FROM` The number of nodes needed to hear from to go live, can be up to the LeafSet.maxSize()
`protected int` | `MAX_TIME_TO_BE_SCHEDULED` This variable is set to prevent the process from going to sleep or not being scheduled for too long.
`int` | `RETRY_INTERVAL` Will retry sending ConsistentJoinMsg to all neighbors who have not responded on this interval.
`protected boolean` | `tryingToGoReady` Suppresses sendTheMessage() if we are not ready to do this part of the join process, or we are already done.

Fields inherited from class rice.pastry.standard.StandardJoinProtocol
`joinEvent, leafSet, localHandle, routeTable`

Fields inherited from class rice.pastry.client.PastryAppl
`address, deserializer, instance, logger, options, receiver, thePastryNode`

Constructor Summary
`ConsistentJoinProtocol(PastryNode ln, NodeHandle lh, RoutingTable rt, LeafSet ls, ReadyStrategy nextReadyStrategy)`
`ConsistentJoinProtocol(PastryNode ln, NodeHandle lh, RoutingTable rt, LeafSet ls, ReadyStrategy nextReadyStrategy, MessageDeserializer md)` Constructor takes in the usual suspects.

Method Summary
`void` | `addToLeafSet(NodeHandle nh)` Observes all NodeHandles added to LeafSet
`int` | `delayInterest()` Part of the LoopObserver interface.
`void` | `destroy()` Called when PastryNode is destroyed.
`void` | `loopTime(int loopTime)` If it took longer than the time to detect faultiness, then other nodes may believe we are faulty.
`void` | `nodeSetUpdate(NodeSetEventSource set, NodeHandle handle, boolean added)`
`void` | `otherNodesMaySuspectFaulty(int timeNotScheduled)` Call this if there is an event such that you may have not received messages for long enough for other nodes to call you faulty.
`void` | `receiveMessage(Message msg)` Handle the CJM as in the MSR-TR
`void` | `requestFromEveryoneWeHaventHeardFrom()`
`void` | `sendTheMessage(NodeHandle nh, boolean reply)` Sends a consistent join protocol message.
`protected void` | `setReady()` This is where we start out, when the StandardJoinProtocol would call setReady();
`void` | `update(java.util.Observable arg0, java.lang.Object arg)` Can be PastryNode updates, leafset updates, or nodehandle updates.
`java.util.Collection<NodeHandle>` | `whoDoWeNeedAResponseFrom()` Returns all members of the leafset that are not in gotResponse

Methods inherited from class rice.pastry.standard.StandardJoinProtocol
`broadcastRows, deliverWhenNotReady, getAddress, initiateJoin, messageForAppl`

Methods inherited from class rice.pastry.client.PastryAppl
`accept, canReceiveSocket, connect, 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

### MAX_TIME_TO_BE_SCHEDULED

    protected final int MAX_TIME_TO_BE_SCHEDULED

  This variable is set to prevent the process from going to sleep or not being scheduled for too long.

### MAX_NUM_TO_HEAR_FROM

    protected final int MAX_NUM_TO_HEAR_FROM

  The number of nodes needed to hear from to go live, can be up to the LeafSet.maxSize()

  See Also:
    Constant Field Values

### tryingToGoReady

    protected boolean tryingToGoReady

  Suppresses sendTheMessage() if we are not ready to do this part of the join process, or we are already done.

### RETRY_INTERVAL

    public final int RETRY_INTERVAL

  Will retry sending ConsistentJoinMsg to all neighbors who have not responded on this interval. Only necessary if somehow the message was dropped.

Constructor Detail

### ConsistentJoinProtocol

    public ConsistentJoinProtocol(PastryNode ln,
                                  NodeHandle lh,
                                  RoutingTable rt,
                                  LeafSet ls,
                                  ReadyStrategy nextReadyStrategy)

### ConsistentJoinProtocol

    public ConsistentJoinProtocol(PastryNode ln,
                                  NodeHandle lh,
                                  RoutingTable rt,
                                  LeafSet ls,
                                  ReadyStrategy nextReadyStrategy,
                                  MessageDeserializer md)

  Constructor takes in the usual suspects.

  Parameters:
    `ln` -
    `lh` -
    `rt` -
    `ls` -
    `nextReadyStrategy` - if non-null, will call nextRenderStrategy.start() when complete
    `md` -

Method Detail

### setReady

    protected void setReady()

  This is where we start out, when the StandardJoinProtocol would call setReady();

  Overrides:
    `setReady` in class `StandardJoinProtocol`

### addToLeafSet

    public void addToLeafSet(NodeHandle nh)

  Observes all NodeHandles added to LeafSet

  Parameters:
    `nh` - the nodeHandle to add

### requestFromEveryoneWeHaventHeardFrom

    public void requestFromEveryoneWeHaventHeardFrom()

### otherNodesMaySuspectFaulty

    public void otherNodesMaySuspectFaulty(int timeNotScheduled)

  Call this if there is an event such that you may have not received messages for long enough for other nodes to call you faulty. This method will call PastryNode.setReady(false) which will stop delivering messages, and then via the observer pattern will call this.update(PN, FALSE) which will call setReady() which will begin the join process again.

### whoDoWeNeedAResponseFrom

    public java.util.Collection<NodeHandle> whoDoWeNeedAResponseFrom()

  Returns all members of the leafset that are not in gotResponse

  Returns:

### receiveMessage

    public void receiveMessage(Message msg)

  Handle the CJM as in the MSR-TR

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

### sendTheMessage

    public void sendTheMessage(NodeHandle nh,
                               boolean reply)

  Sends a consistent join protocol message.

  Parameters:
    `nh` -
    `reply` - if the reason we are sending this message is just as a response

### nodeSetUpdate

    public void nodeSetUpdate(NodeSetEventSource set,
                              NodeHandle handle,
                              boolean added)

  Specified by:
    `nodeSetUpdate` in interface `NodeSetListener`

### update

    public void update(java.util.Observable arg0,
                       java.lang.Object arg)

  Can be PastryNode updates, leafset updates, or nodehandle updates.

  Specified by:
    `update` in interface `java.util.Observer`

### delayInterest

    public int delayInterest()

  Part of the LoopObserver interface. Used to detect if we may have been found faulty by other nodes.

  Specified by:
    `delayInterest` in interface `LoopObserver`
  Returns:
    the minimum loop time we are interested in being notified about.

### loopTime

    public void loopTime(int loopTime)

  If it took longer than the time to detect faultiness, then other nodes may believe we are faulty. So we best rejoin.

  Specified by:
    `loopTime` in interface `LoopObserver`
  Parameters:
    `loopTime` - the time it took to do a single selection loop.

### destroy

    public void destroy()

  Description copied from class: `PastryAppl`
  Called when PastryNode is destroyed. Can be overloaded by applications.

  Overrides:
    `destroy` in class `PastryAppl`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.