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.pns
Class PNSApplication

    java.lang.Object
      rice.pastry.client.PastryAppl
          rice.pastry.pns.PNSApplication

All Implemented Interfaces:
  ProximityListener<NodeHandle>, ProximityNeighborSelector

    public class PNSApplication

extends PastryAppl
implements ProximityNeighborSelector, ProximityListener<NodeHandle>

Can request LeafSet, RouteRow, Proximity of nodes, implemts the PNS algorithim. TODO: Make use the environment's clock for the wait() calls.

Author:
  Jeff Hoye

Field Summary
`static int` | `DEFAULT_PROXIMITY`
`protected Environment` | `environment`
`protected java.util.Map<NodeHandle,java.lang.Integer>` | `pingCache` Hashtable which keeps track of temporary ping values, which are only used during the getNearest() method
`protected byte` | `rtBase`
`protected Timer` | `timer`

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

Constructor Summary
`PNSApplication(PastryNode pn)`

Method Summary
`protected void` | `addToWaitingForLeafSet(NodeHandle handle, Continuation<LeafSet,java.lang.Exception> c, Cancellable cancelMeWhenSuccess)`
`protected void` | `addToWaitingForRouteRow(NodeHandle handle, int row, Continuation<RouteSet[],java.lang.Exception> c, Cancellable cancelMeWhenSuccess)`
`Cancellable` | `getLeafSet(NodeHandle handle, Continuation<LeafSet,java.lang.Exception> c)` Non-blocking version.
`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)`
`Cancellable` | `getProximity(NodeHandle handle, Continuation<java.lang.Integer,java.io.IOException> c, int timeout)` Non-blocking version, no timeout.
`Cancellable` | `getRouteRow(NodeHandle handle, short row, Continuation<RouteSet[],java.lang.Exception> c)` Non-blocking version.
`void` | `messageForAppl(Message msg)` Called by pastry when a message arrives for this application.
`void` | `proximityChanged(NodeHandle i, int newProximity, java.util.Map<java.lang.String,java.lang.Object> options)`
`protected boolean` | `removeFromWaitingForLeafSet(NodeHandle handle, Continuation<LeafSet,java.lang.Exception> c)`
`protected boolean` | `removeFromWaitingForRouteRow(NodeHandle handle, int row, Continuation<RouteSet[],java.lang.Exception> c)`
`java.util.List<NodeHandle>` | `sortedProximityCache()`

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

Field Detail

### DEFAULT_PROXIMITY

    public static final int DEFAULT_PROXIMITY

See Also:
  Constant Field Values

### pingCache

    protected java.util.Map<NodeHandle,java.lang.Integer> pingCache

  Hashtable which keeps track of temporary ping values, which are only used during the getNearest() method

### rtBase

    protected final byte rtBase

### environment

    protected Environment environment

### timer

    protected Timer timer

Constructor Detail

### PNSApplication

    public PNSApplication(PastryNode pn)

Method Detail

### messageForAppl

    public void messageForAppl(Message msg)

  Description copied from class: `PastryAppl`
  Called by pastry when a message arrives for this application.

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

### getNearHandles

    public Cancellable getNearHandles(java.util.Collection<NodeHandle> bootHandles,
                                      Continuation<java.util.Collection<NodeHandle>,java.lang.Exception> deliverResultToMe)

  Specified by:
    `getNearHandles` in interface `ProximityNeighborSelector`

### getLeafSet

    public Cancellable getLeafSet(NodeHandle handle,
                                  Continuation<LeafSet,java.lang.Exception> c)

  Non-blocking version.

  Parameters:
    `handle` -
    `c` -
  Returns:
  Throws:
    `java.io.IOException`

### addToWaitingForLeafSet

    protected void addToWaitingForLeafSet(NodeHandle handle,
                                          Continuation<LeafSet,java.lang.Exception> c,
                                          Cancellable cancelMeWhenSuccess)

### removeFromWaitingForLeafSet

    protected boolean removeFromWaitingForLeafSet(NodeHandle handle,
                                                  Continuation<LeafSet,java.lang.Exception> c)

### getRouteRow

    public Cancellable getRouteRow(NodeHandle handle,
                                   short row,
                                   Continuation<RouteSet[],java.lang.Exception> c)

  Non-blocking version.

  Parameters:
    `handle` -
    `row` -
    `c` -
  Returns:
  Throws:
    `java.io.IOException`

### addToWaitingForRouteRow

    protected void addToWaitingForRouteRow(NodeHandle handle,
                                           int row,
                                           Continuation<RouteSet[],java.lang.Exception> c,
                                           Cancellable cancelMeWhenSuccess)

### removeFromWaitingForRouteRow

    protected boolean removeFromWaitingForRouteRow(NodeHandle handle,
                                                   int row,
                                                   Continuation<RouteSet[],java.lang.Exception> c)

### getProximity

    public Cancellable getProximity(NodeHandle handle,
                                    Continuation<java.lang.Integer,java.io.IOException> c,
                                    int timeout)

  Non-blocking version, no timeout. TODO: Make this fail early if faulty.

  Parameters:
    `handle` -
    `c` -

### proximityChanged

    public void proximityChanged(NodeHandle i,
                                 int newProximity,
                                 java.util.Map<java.lang.String,java.lang.Object> options)

  Specified by:
    `proximityChanged` in interface `ProximityListener<NodeHandle>`

### sortedProximityCache

    public java.util.List<NodeHandle> sortedProximityCache()

### getNearest

    public 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. 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.

  Parameters:
    `seed` - Any member of the pastry ring
  Returns:
    A node suitable to boot off of (which is close the this node)

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.