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

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

Enclosing class:
  SocketSourceRouteManager

    protected class SocketSourceRouteManager.AddressManager

extends java.lang.Object

Internal class which is tasked with maintaining the status of a single remote address. This class is in charge of all source routes to that address, as well as declaring liveness/death of this address

Nested Class Summary
`class` | `SocketSourceRouteManager.AddressManager.SourceRouteManager` Internal class which is charges with managing the remote connection via a specific route

Field Summary
`protected SocketNodeHandle` | `address`
`protected SourceRoute` | `best` the current best route to this remote address if best == null, we are already in a CheckDead, which means we are searching for a path
`protected int` | `liveness`
`protected java.util.LinkedList` | `pendingAppSockets`
`protected java.util.LinkedList` | `queue` the queue of messages waiting for a route of SocketBuffer
`protected java.util.HashMap` | `routes`
`protected long` | `updated`

Constructor Summary
`SocketSourceRouteManager.AddressManager(SocketNodeHandle address, boolean search)` Constructor, given an address and whether or not it should attempt to find the best route

Method Summary
`void` | `checkLiveness()` Method which suggests a ping to the remote node.
`void` | `connect(int appAddress, AppSocketReceiver receiver, int timeout)` Method which opens an app socket to this address
`int` | `getLiveness()` Method which returns the last cached liveness value for the given address.
`protected SocketSourceRouteManager.AddressManager.SourceRouteManager` | `getRouteManager(SourceRoute route)` Method which returns the route manager for the given route
`protected void` | `markAlive(SourceRoute route)` This method should be called when a known route is declared alive.
`protected void` | `markDead(SourceRoute route)` This method should be called when a known route is declared dead.
`protected void` | `markDeadForever()` 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` | `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()` Method which suggests a ping to the remote node.
`int` | `proximity()` Method which returns the last cached proximity value for the given address.
`protected void` | `purgeQueue()`
`int` | `rto()`
`void` | `send(SocketBuffer message)` Method which enqueues a message to this address
`protected void` | `setAlive()` Internal method which marks this address as being alive.
`protected void` | `setDead()` Internal method which marks this address as being dead.
`protected void` | `setDeadForever()` Internal method which marks this address as being dead.
`protected void` | `setSuspected()` Internal method which marks this address as being suspected.
`java.lang.String` | `toString()`

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

Field Detail

### address

    protected SocketNodeHandle address

### best

    protected SourceRoute best

  the current best route to this remote address if best == null, we are already in a CheckDead, which means we are searching for a path

### queue

    protected java.util.LinkedList queue

  the queue of messages waiting for a route of SocketBuffer

### pendingAppSockets

    protected java.util.LinkedList pendingAppSockets

### routes

    protected java.util.HashMap routes

### liveness

    protected int liveness

### updated

    protected long updated

Constructor Detail

### SocketSourceRouteManager.AddressManager

    public SocketSourceRouteManager.AddressManager(SocketNodeHandle address,
                                                   boolean search)

  Constructor, given an address and whether or not it should attempt to find the best route

  Parameters:
    `address` - The address
    `search` - Whether or not the manager should try and find a route

Method Detail

### getRouteManager

    protected SocketSourceRouteManager.AddressManager.SourceRouteManager getRouteManager(SourceRoute route)

  Method which returns the route manager for the given route

  Parameters:
    `route` - The route
  Returns:
    THe manager
  Throws:
    `java.lang.IllegalArgumentException` - if route is null

### proximity

    public int proximity()

  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

### rto

    public int rto()

### getLiveness

    public int getLiveness()

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

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

### markAlive

    protected void markAlive(SourceRoute route)

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

  Parameters:
    `route` - The now-live route

### markSuspected

    protected void markSuspected(SourceRoute route)

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

  Parameters:
    `route` - The now-suspected route

### markDead

    protected void markDead(SourceRoute route)

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

  Parameters:
    `route` - The now-dead route

### markDeadForever

    protected void markDeadForever()

  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

### 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

### send

    public void send(SocketBuffer message)

  Method which enqueues a message to this address

  Parameters:
    `message` - The message to send

### connect

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

  Method which opens an app socket to this address

  Parameters:
    `message` - The message to send

### ping

    public void ping()

  Method which suggests a ping to the remote node.

### checkLiveness

    public void checkLiveness()

  Method which suggests a ping to the remote node.

### setAlive

    protected void setAlive()

  Internal method which marks this address as being alive. If we were dead before, it sends an update out to the observers. best must be non-null

  Throws:
    `java.lang.IllegalStateException` - if best is null.

### setSuspected

    protected void setSuspected()

  Internal method which marks this address as being suspected.

### setDead

    protected void setDead()

  Internal method which marks this address as being dead. If we were alive or suspected before, it sends an update out to the observers.

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### setDeadForever

    protected void setDeadForever()

  Internal method which marks this address as being dead. If we were alive or suspected before, it sends an update out to the observers.

### purgeQueue

    protected void purgeQueue()

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.