Rice Pastry API

rice.pastry.socket.nat.rendezvous
Class RendezvousPNSApplication

java.lang.Object
  extended by rice.pastry.client.PastryAppl
      extended by rice.pastry.pns.PNSApplication
          extended by rice.pastry.socket.nat.rendezvous.RendezvousPNSApplication
All Implemented Interfaces:
ProximityListener<NodeHandle>, ProximityNeighborSelector

public class RendezvousPNSApplication
extends PNSApplication

Does not try to connect to NATted nodes during PNS. TODO: Cull out firewalled nodes from return values TODO: Make Proximity of firewalled nodes MAX_VALUE TODO: Make Rendezvous Layer check the MultiInetSocketAddress to see if they can contact eachother directly

Author:
Jeff Hoye

Field Summary
 
Fields inherited from class rice.pastry.pns.PNSApplication
DEFAULT_PROXIMITY, environment, pingCache, rtBase, timer
 
Fields inherited from class rice.pastry.client.PastryAppl
address, deserializer, instance, logger, options, receiver, thePastryNode
 
Constructor Summary
RendezvousPNSApplication(PastryNode pn, ContactDirectStrategy<RendezvousSocketNodeHandle> contactDirectStrategy)
           
 
Method Summary
 Cancellable getLeafSet(NodeHandle input, Continuation<LeafSet,java.lang.Exception> c)
          This method returns the remote leafset of the provided handle to the caller, in a protocol-dependent fashion.
 Cancellable getNearest(NodeHandle seed, Continuation<java.util.Collection<NodeHandle>,java.lang.Exception> retToMe)
          This method implements the algorithm in the Pastry locality paper for finding a close node the the current node through iterative leafset and route row requests.
 Cancellable getNearHandles(java.util.Collection<NodeHandle> bootHandles, Continuation<java.util.Collection<NodeHandle>,java.lang.Exception> deliverResultToMe)
          This is the first step, cull out the bootHandles that we can't use good.
protected  java.util.List<NodeHandle> getNearHandlesHelper(java.util.List<NodeHandle> handles)
          Don't return any non-contactDirect handles unless all of them are.
 Cancellable getProximity(NodeHandle handle, Continuation<java.lang.Integer,java.io.IOException> c, int timeout)
          Non-blocking version, no timeout.
 Cancellable getRouteRow(NodeHandle input, short row, Continuation<RouteSet[],java.lang.Exception> c)
          Non-blocking version.
protected  boolean ignore(NodeHandle handle, Continuation c)
          This method decides who to bother trying to connect to.
protected  boolean useHandle(NodeHandle handle)
          Separate this out to make it super easy to change the policy.
 
Methods inherited from class rice.pastry.pns.PNSApplication
addToWaitingForLeafSet, addToWaitingForRouteRow, deliverWhenNotReady, messageForAppl, proximityChanged, removeFromWaitingForLeafSet, removeFromWaitingForRouteRow, sortedProximityCache
 
Methods inherited from class rice.pastry.client.PastryAppl
accept, canReceiveSocket, connect, destroy, enrouteMessage, finishReceiveSocket, getAddress, getDeserializer, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, leafSetChange, 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
 

Constructor Detail

RendezvousPNSApplication

public RendezvousPNSApplication(PastryNode pn,
                                ContactDirectStrategy<RendezvousSocketNodeHandle> contactDirectStrategy)
Method Detail

ignore

protected boolean ignore(NodeHandle handle,
                         Continuation c)
This method decides who to bother trying to connect to. If the node is not NATted, return false. If the node is NATted: c.receiveException() return true

Parameters:
handle -
c -
Returns:

useHandle

protected boolean useHandle(NodeHandle handle)
Separate this out to make it super easy to change the policy.

Parameters:
handle -
Returns:

getNearHandlesHelper

protected java.util.List<NodeHandle> getNearHandlesHelper(java.util.List<NodeHandle> handles)
Don't return any non-contactDirect handles unless all of them are.

Overrides:
getNearHandlesHelper in class PNSApplication
Returns:

getNearHandles

public Cancellable getNearHandles(java.util.Collection<NodeHandle> bootHandles,
                                  Continuation<java.util.Collection<NodeHandle>,java.lang.Exception> deliverResultToMe)
This is the first step, cull out the bootHandles that we can't use good.

Specified by:
getNearHandles in interface ProximityNeighborSelector
Overrides:
getNearHandles in class PNSApplication

getLeafSet

public Cancellable getLeafSet(NodeHandle input,
                              Continuation<LeafSet,java.lang.Exception> c)
Description copied from class: PNSApplication
This method returns the remote leafset of the provided handle to the caller, in a protocol-dependent fashion. Note that this method may block while sending the message across the wire. Non-blocking version.

Overrides:
getLeafSet in class PNSApplication
Parameters:
input - The node to connect to
c - Continuation to return the LeafSet to
Returns:

getRouteRow

public Cancellable getRouteRow(NodeHandle input,
                               short row,
                               Continuation<RouteSet[],java.lang.Exception> c)
Description copied from class: PNSApplication
Non-blocking version.

Overrides:
getRouteRow in class PNSApplication
Returns:

getNearest

public Cancellable getNearest(NodeHandle seed,
                              Continuation<java.util.Collection<NodeHandle>,java.lang.Exception> retToMe)
Description copied from class: PNSApplication
This method implements the algorithm in the Pastry locality paper for finding a close node the the current node through iterative leafset and route row requests. The seed node provided is any node in the network which is a member of the pastry ring. This algorithm is designed to work in a protocol-independent manner, using the getResponse(Message) method provided by subclasses.

Overrides:
getNearest in class PNSApplication
Parameters:
seed - Any member of the pastry ring
Returns:
A node suitable to boot off of (which is close the this node)

getProximity

public Cancellable getProximity(NodeHandle handle,
                                Continuation<java.lang.Integer,java.io.IOException> c,
                                int timeout)
Description copied from class: PNSApplication
Non-blocking version, no timeout. TODO: Make this fail early if faulty.

Overrides:
getProximity in class PNSApplication

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection