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.socket
Class SocketSourceRouteManager

    java.lang.Object
      rice.pastry.socket.SocketSourceRouteManager

    public class SocketSourceRouteManager

extends java.lang.Object

Class which keeps track of the best routes to remote nodes. This class is also therefore in charge of declaring node death and liveness.

Version:
  $Id: SocketSourceRouteManager.java 3435 2006-10-27 13:35:26Z jeffh $
Author:
  Alan Mislove

Nested Class Summary
`protected class` | `SocketSourceRouteManager.AddressManager` Internal class which is tasked with maintaining the status of a single remote address.

Field Summary
`long` | `CHECK_DEAD_THROTTLE` DESCRIBE THE FIELD
`int` | `DEFAULT_RTO` DESCRIBE THE FIELD
`int` | `NUM_SOURCE_ROUTE_ATTEMPTS` DESCRIBE THE FIELD
`long` | `PING_THROTTLE` DESCRIBE THE FIELD
`int` | `PROX_TIMEOUT` millis for the timeout The idea is that we don't want this parameter to change too fast, so this is the timeout for it to increase, you could set this to infinity, but that may be bad because it doesn't account for intermediate link failures

Constructor Summary
`protected` | `SocketSourceRouteManager(SocketPastryNode node, EpochInetSocketAddress bindAddress, EpochInetSocketAddress proxyAddress, RandomSource random)` Constructor

Method Summary
`void` | `bootstrap(EpochInetSocketAddress address, Message msg)` Method which sends a bootstrap message across the wire.
`void` | `checkLiveness(EpochInetSocketAddress address)` Method which FORCES a check of liveness of the remote node.
`NodeHandle` | `coalesce(NodeHandle newHandle)` EpochInetSocketAddress -> WeakReference(NodeHandle) Note that it is critical to keep the key == NodeHandle.eaddress.
`void` | `connect(EpochInetSocketAddress address, int appAddress, AppSocketReceiver receiver, int timeout)` Method which sends a message across the wire.
`void` | `destroy()` Makes this node resign from the network.
`SocketSourceRouteManager.AddressManager` | `getAddressManager(EpochInetSocketAddress address)` Gets the AddressManager attribute of the SocketSourceRouteManager object
`protected SocketSourceRouteManager.AddressManager` | `getAddressManager(EpochInetSocketAddress address, boolean search)` Internal method which returns (or builds) the manager associated with an address
`protected SourceRoute[]` | `getAllRoutes(EpochInetSocketAddress destination)` Internal method which returns a list of all possible routes to a given address.
`java.util.HashMap` | `getBest()` Gets the Best attribute of the SocketSourceRouteManager object
`protected SourceRoute` | `getBestRoute(EpochInetSocketAddress address)` Internal method which returns the best known route to the given destination
`int` | `getLiveness(EpochInetSocketAddress address)` Method which returns the last cached liveness value for the given address.
`SocketCollectionManager` | `getManager()` Method which returns the internal manager
`SocketNodeHandle` | `getNodeHandle(EpochInetSocketAddress address)` Gets the NodeHandle attribute of the SocketSourceRouteManager object
`protected void` | `markAlive(SourceRoute route)` This method should be called when a known route is declared alive.
`protected void` | `markDead(EpochInetSocketAddress address)` This method should be called when a known node is declared dead - this is ONLY called when a new epoch of that node is detected.
`protected void` | `markDead(SourceRoute route)` This method should be called when a known route is declared dead.
`protected void` | `markProximity(SourceRoute route, int proximity)` This method should be called when a known route has its proximity updated
`protected void` | `markSuspected(SourceRoute route)` This method should be called when a known route is declared suspected.
`void` | `ping(EpochInetSocketAddress address)` Method which suggests a ping to the remote node.
`int` | `proximity(EpochInetSocketAddress address)` Method which returns the last cached proximity value for the given address.
`protected int` | `proximity(SourceRoute route)` DESCRIBE THE METHOD
`SocketSourceRouteManager.AddressManager` | `putAddressManager(EpochInetSocketAddress address, boolean search)` Should be called while synchronized on nodeHandles
`protected void` | `reroute(EpochInetSocketAddress address, SocketBuffer m)` Reroutes the given message.
`protected int` | `rto(SourceRoute route)` DESCRIBE THE METHOD
`void` | `send(EpochInetSocketAddress address, Message msg)` DESCRIBE THE METHOD
`void` | `send(EpochInetSocketAddress address, SocketBuffer message)` Method which sends a message across the wire.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### CHECK_DEAD_THROTTLE

    public long CHECK_DEAD_THROTTLE

  DESCRIBE THE FIELD

### PING_THROTTLE

    public long PING_THROTTLE

  DESCRIBE THE FIELD

### NUM_SOURCE_ROUTE_ATTEMPTS

    public int NUM_SOURCE_ROUTE_ATTEMPTS

  DESCRIBE THE FIELD

### PROX_TIMEOUT

    public int PROX_TIMEOUT

  millis for the timeout The idea is that we don't want this parameter to change too fast, so this is the timeout for it to increase, you could set this to infinity, but that may be bad because it doesn't account for intermediate link failures

### DEFAULT_RTO

    public int DEFAULT_RTO

  DESCRIBE THE FIELD

Constructor Detail

### SocketSourceRouteManager

    protected SocketSourceRouteManager(SocketPastryNode node,
                                       EpochInetSocketAddress bindAddress,
                                       EpochInetSocketAddress proxyAddress,
                                       RandomSource random)
                                throws java.io.IOException

  Constructor

  Parameters:
    `node` - The local node
    `bindAddress` - The address which the node should bind to
    `proxyAddress` - The address which the node should advertise as it's address
    `random` - DESCRIBE THE PARAMETER
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

Method Detail

### getBest

    public java.util.HashMap getBest()

  Gets the Best attribute of the SocketSourceRouteManager object

  Returns:
    The Best value

### getManager

    public SocketCollectionManager getManager()

  Method which returns the internal manager

  Returns:
    The internal manager

### getAddressManager

    protected SocketSourceRouteManager.AddressManager getAddressManager(EpochInetSocketAddress address,
                                                                        boolean search)

  Internal method which returns (or builds) the manager associated with an address

  Parameters:
    `address` - The remote address
    `search` - DESCRIBE THE PARAMETER
  Returns:
    The AddressManager value

### getNodeHandle

    public SocketNodeHandle getNodeHandle(EpochInetSocketAddress address)

  Gets the NodeHandle attribute of the SocketSourceRouteManager object

  Parameters:
    `address` - DESCRIBE THE PARAMETER
  Returns:
    The NodeHandle value

### getAddressManager

    public SocketSourceRouteManager.AddressManager getAddressManager(EpochInetSocketAddress address)

  Gets the AddressManager attribute of the SocketSourceRouteManager object

  Parameters:
    `address` - DESCRIBE THE PARAMETER
  Returns:
    The AddressManager value

### getLiveness

    public int getLiveness(EpochInetSocketAddress address)

  Method which returns the last cached liveness value for the given address. If there is no cached value, then LIVENESS_ALIVE

  Parameters:
    `address` - The address to return the value for
  Returns:
    The liveness value

### getAllRoutes

    protected SourceRoute[] getAllRoutes(EpochInetSocketAddress destination)

  Internal method which returns a list of all possible routes to a given address. Currently, this method simply sees if any of the leafset members are able to reach the node.

  Parameters:
    `destination` - DESCRIBE THE PARAMETER
  Returns:
    All possible source routes to the destination

### getBestRoute

    protected SourceRoute getBestRoute(EpochInetSocketAddress address)

  Internal method which returns the best known route to the given destination

  Parameters:
    `address` - The address
  Returns:
    The BestRoute value

### destroy

    public void destroy()
                 throws java.io.IOException

  Makes this node resign from the network. Is designed to be used for debugging and testing.

  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### coalesce

    public NodeHandle coalesce(NodeHandle newHandle)

  EpochInetSocketAddress -> WeakReference(NodeHandle) Note that it is critical to keep the key == NodeHandle.eaddress. And I mean the same object!!! not .equals(). The whole memory management will get confused if this is not the case.

  Parameters:
    `newHandle` - DESCRIBE THE PARAMETER
  Returns:
    DESCRIBE THE RETURN VALUE

### putAddressManager

    public SocketSourceRouteManager.AddressManager putAddressManager(EpochInetSocketAddress address,
                                                                     boolean search)

  Should be called while synchronized on nodeHandles

  Parameters:
    `address` -
    `search` - DESCRIBE THE PARAMETER
  Returns:
    DESCRIBE THE RETURN VALUE

### bootstrap

    public void bootstrap(EpochInetSocketAddress address,
                          Message msg)
                   throws java.io.IOException

  Method which sends a bootstrap message across the wire.

  Parameters:
    `address` - The address to send the message to
    `msg` - DESCRIBE THE PARAMETER
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### send

    public void send(EpochInetSocketAddress address,
                     Message msg)
              throws java.io.IOException

  DESCRIBE THE METHOD

  Parameters:
    `address` - DESCRIBE THE PARAMETER
    `msg` - DESCRIBE THE PARAMETER
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### send

    public void send(EpochInetSocketAddress address,
                     SocketBuffer message)

  Method which sends a message across the wire.

  Parameters:
    `address` - The address to send the message to
    `message` - The message to send

### connect

    public void connect(EpochInetSocketAddress address,
                        int appAddress,
                        AppSocketReceiver receiver,
                        int timeout)

  Method which sends a message across the wire.

  Parameters:
    `address` - The address to send the message to
    `appAddress` - DESCRIBE THE PARAMETER
    `receiver` - DESCRIBE THE PARAMETER
    `timeout` - DESCRIBE THE PARAMETER

### ping

    public void ping(EpochInetSocketAddress address)

  Method which suggests a ping to the remote node.

  Parameters:
    `address` - DESCRIBE THE PARAMETER

### checkLiveness

    public void checkLiveness(EpochInetSocketAddress address)

  Method which FORCES a check of liveness of the remote node. Note that this method should ONLY be called by internal Pastry maintenance algorithms - this is NOT to be used by applications. Doing so will likely cause a blowup of liveness traffic.

  Parameters:
    `address` - DESCRIBE THE PARAMETER

### proximity

    public int proximity(EpochInetSocketAddress address)

  Method which returns the last cached proximity value for the given address. If there is no cached value, then DEFAULT_PROXIMITY is returned.

  Parameters:
    `address` - The address to return the value for
  Returns:
    The ping value to the remote address

### markDead

    protected void markDead(SourceRoute route)

  This method should be called when a known route is declared dead.

  Parameters:
    `route` - The now-dead route

### markDead

    protected void markDead(EpochInetSocketAddress address)

  This method should be called when a known node is declared dead - this is ONLY called when a new epoch of that node is detected. Note that this method is silent - no checks are done. Caveat emptor.

  Parameters:
    `address` - The now-dead address

### markAlive

    protected void markAlive(SourceRoute route)

  This method should be called when a known route is declared alive.

  Parameters:
    `route` - The now-live route

### proximity

    protected int proximity(SourceRoute route)

  DESCRIBE THE METHOD

  Parameters:
    `route` - DESCRIBE THE PARAMETER
  Returns:
    DESCRIBE THE RETURN VALUE

### rto

    protected int rto(SourceRoute route)

  DESCRIBE THE METHOD

  Parameters:
    `route` - DESCRIBE THE PARAMETER
  Returns:
    DESCRIBE THE RETURN VALUE

### markSuspected

    protected void markSuspected(SourceRoute route)

  This method should be called when a known route is declared suspected.

  Parameters:
    `route` - The now-live route

### markProximity

    protected void markProximity(SourceRoute route,
                                 int proximity)

  This method should be called when a known route has its proximity updated

  Parameters:
    `route` - The route
    `proximity` - The proximity

### reroute

    protected void reroute(EpochInetSocketAddress address,
                           SocketBuffer m)

  Reroutes the given message. If this node is alive, send() is called. If this node is not alive and the message is a route message, it is rerouted. Otherwise, the message is dropped. Can be called when a socket is closed, if for example a different source route is found. This is how non-routemessages may be called here For suspected/dead, it will get called with all RouteMessages

  Parameters:
    `address` - The address of the remote node
    `m` - The message

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.