Rice Pastry API

rice.pastry.standard
Class PeriodicLeafSetProtocol

java.lang.Object
  extended byrice.pastry.client.PastryAppl
      extended byrice.pastry.standard.PeriodicLeafSetProtocol
All Implemented Interfaces:
NodeSetListener, java.util.Observer, ReadyStrategy

public class PeriodicLeafSetProtocol
extends PastryAppl
implements ReadyStrategy, NodeSetListener

An implementation of a periodic-style leafset protocol

Version:
$Id: PeriodicLeafSetProtocol.java 3334 2006-07-04 12:42:34Z jeffh $
Author:
Alan Mislove

Nested Class Summary
static class PeriodicLeafSetProtocol.PLSPMessageDeserializer
          DESCRIBE THE CLASS
 
Field Summary
 int BLS_THROTTLE
          DESCRIBE THE FIELD
 int CHECK_LIVENESS_PERIOD
          DESCRIBE THE FIELD
protected  java.util.WeakHashMap lastTimeReceivedBLS
          NodeHandle -> Long remembers the TIME when we received a BLS from that NodeHandle
protected  java.util.WeakHashMap lastTimeSentBLS
          DESCRIBE THE FIELD
protected  LeafSet leafSet
          DESCRIBE THE FIELD
 int LEASE_PERIOD
          DESCRIBE THE FIELD
protected  NodeHandle localHandle
          DESCRIBE THE FIELD
protected  PastryNode localNode
          DESCRIBE THE FIELD
 int PING_NEIGHBOR_PERIOD
          Related to rapidly determining direct neighbor liveness.
protected  RoutingTable routeTable
          DESCRIBE THE FIELD
 
Fields inherited from class rice.pastry.client.PastryAppl
address, deserializer, instance, logger, receiver, thePastryNode
 
Constructor Summary
PeriodicLeafSetProtocol(PastryNode ln, NodeHandle local, LeafSet ls, RoutingTable rt)
          Builds a periodic leafset protocol
 
Method Summary
protected  void broadcastAll()
          Broadcast the leaf set to all members of the local leaf set.
 boolean deliverWhenNotReady()
          We always want to receive messages.
 void destroy()
          DESCRIBE THE METHOD
 boolean isReady()
          Gets the Ready attribute of the ReadyStrategy object
 void messageForAppl(Message msg)
          Should not be called becasue we are overriding the receiveMessage() interface anyway.
 void nodeSetUpdate(NodeSetEventSource nodeSetEventSource, NodeHandle handle, boolean added)
          DESCRIBE THE METHOD
 void receiveMessage(Message msg)
          Receives messages.
 void setReady(boolean r)
          Sets the Ready attribute of the PeriodicLeafSetProtocol object
 boolean shouldBeReady()
          DESCRIBE THE METHOD
 void start()
          DESCRIBE THE METHOD
 
Methods inherited from class rice.pastry.client.PastryAppl
accept, connect, enrouteMessage, getAddress, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, leafSetChange, notifyReady, receiveMessageInternal, receiveSocket, register, routeMsg, routeMsgDirect, routeSetChange, setDeserializer, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localHandle

protected NodeHandle localHandle
DESCRIBE THE FIELD


localNode

protected PastryNode localNode
DESCRIBE THE FIELD


leafSet

protected LeafSet leafSet
DESCRIBE THE FIELD


routeTable

protected RoutingTable routeTable
DESCRIBE THE FIELD


lastTimeReceivedBLS

protected java.util.WeakHashMap lastTimeReceivedBLS
NodeHandle -> Long remembers the TIME when we received a BLS from that NodeHandle


lastTimeSentBLS

protected java.util.WeakHashMap lastTimeSentBLS
DESCRIBE THE FIELD


PING_NEIGHBOR_PERIOD

public final int PING_NEIGHBOR_PERIOD
Related to rapidly determining direct neighbor liveness.


LEASE_PERIOD

public final int LEASE_PERIOD
DESCRIBE THE FIELD


CHECK_LIVENESS_PERIOD

public final int CHECK_LIVENESS_PERIOD
DESCRIBE THE FIELD


BLS_THROTTLE

public final int BLS_THROTTLE
DESCRIBE THE FIELD

See Also:
Constant Field Values
Constructor Detail

PeriodicLeafSetProtocol

public PeriodicLeafSetProtocol(PastryNode ln,
                               NodeHandle local,
                               LeafSet ls,
                               RoutingTable rt)
Builds a periodic leafset protocol

Parameters:
ln - DESCRIBE THE PARAMETER
local - DESCRIBE THE PARAMETER
ls - DESCRIBE THE PARAMETER
rt - DESCRIBE THE PARAMETER
Method Detail

isReady

public boolean isReady()
Description copied from interface: ReadyStrategy
Gets the Ready attribute of the ReadyStrategy object

Specified by:
isReady in interface ReadyStrategy
Returns:
The Ready value

setReady

public void setReady(boolean r)
Sets the Ready attribute of the PeriodicLeafSetProtocol object

Specified by:
setReady in interface ReadyStrategy
Parameters:
r - The new Ready value

receiveMessage

public void receiveMessage(Message msg)
Receives messages.

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

broadcastAll

protected void broadcastAll()
Broadcast the leaf set to all members of the local leaf set.


start

public void start()
DESCRIBE THE METHOD

Specified by:
start in interface ReadyStrategy

nodeSetUpdate

public void nodeSetUpdate(NodeSetEventSource nodeSetEventSource,
                          NodeHandle handle,
                          boolean added)
DESCRIBE THE METHOD

Specified by:
nodeSetUpdate in interface NodeSetListener
Parameters:
nodeSetEventSource - DESCRIBE THE PARAMETER
handle - DESCRIBE THE PARAMETER
added - DESCRIBE THE PARAMETER

shouldBeReady

public boolean shouldBeReady()
DESCRIBE THE METHOD

Returns:
DESCRIBE THE RETURN VALUE

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 - DESCRIBE THE PARAMETER

deliverWhenNotReady

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

Overrides:
deliverWhenNotReady in class PastryAppl
Returns:
DESCRIBE THE RETURN VALUE

destroy

public void destroy()
DESCRIBE THE METHOD

Overrides:
destroy in class PastryAppl

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.