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 StandardLeafSetProtocol

    java.lang.Object
      rice.pastry.client.PastryAppl
          rice.pastry.standard.StandardLeafSetProtocol

All Implemented Interfaces:
  java.util.Observer, LeafSetProtocol

    public class StandardLeafSetProtocol

extends PastryAppl
implements LeafSetProtocol, java.util.Observer

An implementation of a simple leaf set protocol.

Version:
  $Id: StandardLeafSetProtocol.java 4082 2008-01-29 11:46:45Z jeffh $
Author:
  Peter Druschel, Andrew Ladd

Field Summary
`protected boolean` | `failstop`
`protected LeafSet` | `leafSet`
`protected Logger` | `logger`
`protected RoutingTable` | `routeTable`

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

Constructor Summary
`StandardLeafSetProtocol(PastryNode ln, NodeHandle local, LeafSet ls, RoutingTable rt)`

Method Summary
`protected void` | `broadcast()` Broadcast the leaf set to all members of the local leaf set.
`protected void` | `broadcast(int type)` Broadcast the leaf set to all members of the local leaf set.
`protected void` | `broadcast(LeafSet ls, NodeHandle from)` Broadcast the local leaf set to all members of the given leaf set, plus the node from which the leaf set was received.
`protected boolean` | `checkLeafSet(LeafSet remotels, NodeHandle from, boolean notifyMissing)` Checks a received leafset advertisement for missing nodes
`boolean` | `deliverWhenNotReady()` Instructs the MessageDispatch how to behave when the PastryNode is not ready.
`void` | `leafSetChange(NodeHandle nh, boolean wasAdded)` We manage the leafset now.
`void` | `maintainLeafSet()` Maintain the leaf set.
`protected boolean` | `mergeLeafSet(LeafSet remotels, NodeHandle from)` Merge a remote leafset into our own
`void` | `messageForAppl(Message msg)` Receives messages.
`void` | `update(java.util.Observable o, java.lang.Object arg)` If nodehandle is dead, remove it from the leafset.

Methods inherited from class rice.pastry.client.PastryAppl
`accept, canReceiveSocket, connect, destroy, enrouteMessage, finishReceiveSocket, getAddress, getDeserializer, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, notifyReady, receiveMessage, 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

### failstop

    protected final boolean failstop

See Also:
  Constant Field Values

### leafSet

    protected LeafSet leafSet

### routeTable

    protected RoutingTable routeTable

### logger

    protected Logger logger

Constructor Detail

### StandardLeafSetProtocol

    public StandardLeafSetProtocol(PastryNode ln,
                                   NodeHandle local,
                                   LeafSet ls,
                                   RoutingTable rt)

Method Detail

### messageForAppl

    public void messageForAppl(Message msg)

  Receives messages.

  Specified by:
    `messageForAppl` in class `PastryAppl`
  Parameters:
    `msg` - the message.

### checkLeafSet

    protected boolean checkLeafSet(LeafSet remotels,
                                   NodeHandle from,
                                   boolean notifyMissing)

  Checks a received leafset advertisement for missing nodes

  Parameters:
    `remotels` - the remote leafset
    `from` - the node from which we received the leafset
    `notifyMissing` - if true, notify missing nodes
  Returns:
    true if any nodes where found missing in the received leafset

### mergeLeafSet

    protected boolean mergeLeafSet(LeafSet remotels,
                                   NodeHandle from)

  Merge a remote leafset into our own

  Parameters:
    `remotels` - the remote leafset
    `from` - the node from which we received the leafset
  Returns:
    true if the leafset changed

### broadcast

    protected void broadcast()

  Broadcast the leaf set to all members of the local leaf set.

### broadcast

    protected void broadcast(int type)

  Broadcast the leaf set to all members of the local leaf set.

  Parameters:
    `type` - the type of broadcast message used

### broadcast

    protected void broadcast(LeafSet ls,
                             NodeHandle from)

  Broadcast the local leaf set to all members of the given leaf set, plus the node from which the leaf set was received.

  Parameters:
    `ls` - the leafset whose members we send to local leaf set
    `from` - the node from which ls was received

### maintainLeafSet

    public void maintainLeafSet()

  Maintain the leaf set. This method checks for dead leafset entries and replaces them as needed. It is assumed that this method be invoked periodically.

### deliverWhenNotReady

    public boolean deliverWhenNotReady()

  Description copied from class: `PastryAppl`
  Instructs the MessageDispatch how to behave when the PastryNode is not ready. An application can override this method to return true if it wishes to receive messages before Pastry is ready(). Most applications should leave this as false, so that their application does not have inconsistent routing. However Pastry's protocols (such as the join protocol) need to receive messages before pastry is ready(). This is because they are attempting to make pastry ready().

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

### leafSetChange

    public void leafSetChange(NodeHandle nh,
                              boolean wasAdded)

  We manage the leafset now. Implementation is simple, remove items that die. We should be observers on everything in the leafset, and nothing else.

  Overrides:
    `leafSetChange` in class `PastryAppl`
  Parameters:
    `nh` - the handle of the node that was added or removed.
    `wasAdded` - true if the node was added, false if the node was removed.

### update

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

  If nodehandle is dead, remove it from the leafset.

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

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.