|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.pastry.client.PastryAppl rice.pastry.standard.PeriodicLeafSetProtocol
public class PeriodicLeafSetProtocol
An implementation of a periodic-style leafset protocol
Nested Class Summary | |
---|---|
static class |
PeriodicLeafSetProtocol.PLSPMessageDeserializer
|
Field Summary | |
---|---|
int |
BLS_THROTTLE
|
protected java.util.Map<NodeHandle,java.lang.Long> |
lastTimeReceivedBLS
NodeHandle -> Long remembers the TIME when we received a BLS from that NodeHandle |
protected java.util.Map<NodeHandle,java.lang.Long> |
lastTimeSentBLS
|
protected LeafSet |
leafSet
|
int |
LEASE_PERIOD
|
protected NodeHandle |
localHandle
|
protected PastryNode |
localNode
|
int |
PING_NEIGHBOR_PERIOD
Related to rapidly determining direct neighbor liveness. |
protected RoutingTable |
routeTable
|
Fields inherited from class rice.pastry.client.PastryAppl |
---|
address, deserializer, instance, logger, options, 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()
Called when PastryNode is destroyed. |
boolean |
hasLease(NodeHandle nh)
Do we have a lease from this node? Returns true if nh is null. |
boolean |
isReady()
|
void |
leafSetChange(NodeHandle nh,
boolean wasAdded)
Called by pastry when the leaf set changes. |
void |
messageForAppl(Message msg)
Should not be called becasue we are overriding the receiveMessage() interface anyway. |
void |
nodeSetUpdate(NodeSetEventSource nodeSetEventSource,
NodeHandle handle,
boolean added)
|
void |
receiveMessage(Message msg)
Receives messages. |
void |
removeFromLeafsetIfPossible(NodeHandle nh)
|
void |
setReady(boolean r)
|
boolean |
shouldBeReady()
|
void |
start()
Called when it is time to take over as the renderstrategy. |
void |
stop()
|
void |
update(java.util.Observable o,
java.lang.Object arg)
Only remove the item if you did not give a lease. |
Methods inherited from class rice.pastry.client.PastryAppl |
---|
accept, canReceiveSocket, connect, enrouteMessage, finishReceiveSocket, getAddress, getDeserializer, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, 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 |
---|
protected NodeHandle localHandle
protected PastryNode localNode
protected LeafSet leafSet
protected RoutingTable routeTable
protected java.util.Map<NodeHandle,java.lang.Long> lastTimeReceivedBLS
protected java.util.Map<NodeHandle,java.lang.Long> lastTimeSentBLS
public final int PING_NEIGHBOR_PERIOD
public final int LEASE_PERIOD
public final int BLS_THROTTLE
Constructor Detail |
---|
public PeriodicLeafSetProtocol(PastryNode ln, NodeHandle local, LeafSet ls, RoutingTable rt)
Method Detail |
---|
public void receiveMessage(Message msg)
receiveMessage
in class PastryAppl
msg
- the message.protected void broadcastAll()
type
- the type of broadcast message usedpublic void start()
ReadyStrategy
start
in interface ReadyStrategy
public void stop()
stop
in interface ReadyStrategy
public void nodeSetUpdate(NodeSetEventSource nodeSetEventSource, NodeHandle handle, boolean added)
nodeSetUpdate
in interface NodeSetListener
public void setReady(boolean r)
setReady
in interface ReadyStrategy
public boolean isReady()
isReady
in interface ReadyStrategy
public boolean shouldBeReady()
public boolean hasLease(NodeHandle nh)
nh
- the NodeHandle we are interested if we have a lease from
public void messageForAppl(Message msg)
messageForAppl
in class PastryAppl
msg
- the message that is arriving.public boolean deliverWhenNotReady()
deliverWhenNotReady
in class PastryAppl
public void destroy()
PastryAppl
destroy
in class PastryAppl
public void leafSetChange(NodeHandle nh, boolean wasAdded)
PastryAppl
leafSetChange
in class PastryAppl
nh
- the handle of the node that was added or removed.wasAdded
- true if the node was added, false if the node was removed.public void update(java.util.Observable o, java.lang.Object arg)
update
in interface java.util.Observer
public void removeFromLeafsetIfPossible(NodeHandle nh)
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |