Rice Pastry API

org.mpisws.p2p.transport.sourceroute.manager
Class SourceRouteManagerImpl.AddressManager

java.lang.Object
  extended by org.mpisws.p2p.transport.sourceroute.manager.SourceRouteManagerImpl.AddressManager
Enclosing class:
SourceRouteManagerImpl<Identifier>

protected class SourceRouteManagerImpl.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


Field Summary
protected  Identifier address
           
protected  SourceRoute<Identifier> 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
           
static int LIVENESS_UNKNOWN
           
protected  java.util.LinkedList<org.mpisws.p2p.transport.sourceroute.manager.SourceRouteManagerImpl.AddressManager.PendingMessage> pendingMessages
          the queue of messages waiting for a route of SocketBuffer
protected  java.util.LinkedList<org.mpisws.p2p.transport.sourceroute.manager.SourceRouteManagerImpl.AddressManager.PendingSocket> pendingSockets
           
protected  long updated
           
 
Constructor Summary
SourceRouteManagerImpl.AddressManager(Identifier address)
          Constructor, given an address and whether or not it should attempt to find the best route
 
Method Summary
 boolean checkLiveness(java.util.Map<java.lang.String,java.lang.Object> options)
          Method which suggests a ping to the remote node.
 void clearLivenessState()
           
 int getLiveness(java.util.Map<java.lang.String,java.lang.Object> options)
          Method which returns the last cached liveness value for the given address.
 void livenessChanged(SourceRoute<Identifier> i, int val, java.util.Map<java.lang.String,java.lang.Object> options)
           
protected  void markAlive(SourceRoute<Identifier> route, java.util.Map<java.lang.String,java.lang.Object> options)
          This method should be called when a known route is declared alive.
protected  void markDead(SourceRoute<Identifier> deadRoute, java.util.Map<java.lang.String,java.lang.Object> options)
          This method should be called when a known route is declared dead.
protected  void markDeadForever(java.util.Map<java.lang.String,java.lang.Object> options)
          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<Identifier> route, int proximity, java.util.Map<java.lang.String,java.lang.Object> options)
          This method should be called when a known route has its proximity updated
protected  void markSuspected(SourceRoute<Identifier> route, java.util.Map<java.lang.String,java.lang.Object> options)
          This method should be called when a known route is declared suspected.
 SocketRequestHandle<Identifier> openSocket(SocketCallback<Identifier> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)
          Method which opens an app socket to this address
 int proximity(java.util.Map<java.lang.String,java.lang.Object> options)
          Method which returns the last cached proximity value for the given address.
protected  void purgeQueue()
           
 MessageRequestHandle<Identifier,java.nio.ByteBuffer> sendMessage(java.nio.ByteBuffer message, MessageCallback<Identifier,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
          Method which enqueues a message to this address
protected  void setAlive(java.util.Map<java.lang.String,java.lang.Object> options)
          Internal method which marks this address as being alive.
protected  void setDead(java.util.Map<java.lang.String,java.lang.Object> options)
          Internal method which marks this address as being dead.
protected  void setDeadForever(java.util.Map<java.lang.String,java.lang.Object> options)
          Internal method which marks this address as being dead.
protected  void setSuspected(java.util.Map<java.lang.String,java.lang.Object> options)
          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 Identifier address

best

protected SourceRoute<Identifier> 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


pendingMessages

protected java.util.LinkedList<org.mpisws.p2p.transport.sourceroute.manager.SourceRouteManagerImpl.AddressManager.PendingMessage> pendingMessages
the queue of messages waiting for a route of SocketBuffer


pendingSockets

protected java.util.LinkedList<org.mpisws.p2p.transport.sourceroute.manager.SourceRouteManagerImpl.AddressManager.PendingSocket> pendingSockets

liveness

protected int liveness

updated

protected long updated

LIVENESS_UNKNOWN

public static final int LIVENESS_UNKNOWN
See Also:
Constant Field Values
Constructor Detail

SourceRouteManagerImpl.AddressManager

public SourceRouteManagerImpl.AddressManager(Identifier address)
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

clearLivenessState

public void clearLivenessState()

proximity

public int proximity(java.util.Map<java.lang.String,java.lang.Object> options)
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

getLiveness

public int getLiveness(java.util.Map<java.lang.String,java.lang.Object> options)
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

sendMessage

public MessageRequestHandle<Identifier,java.nio.ByteBuffer> sendMessage(java.nio.ByteBuffer message,
                                                                        MessageCallback<Identifier,java.nio.ByteBuffer> deliverAckToMe,
                                                                        java.util.Map<java.lang.String,java.lang.Object> options)
Method which enqueues a message to this address

Parameters:
message - The message to send

openSocket

public SocketRequestHandle<Identifier> openSocket(SocketCallback<Identifier> deliverSocketToMe,
                                                  java.util.Map<java.lang.String,java.lang.Object> options)
Method which opens an app socket to this address

Parameters:
message - The message to send

checkLiveness

public boolean checkLiveness(java.util.Map<java.lang.String,java.lang.Object> options)
Method which suggests a ping to the remote node.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

livenessChanged

public void livenessChanged(SourceRoute<Identifier> i,
                            int val,
                            java.util.Map<java.lang.String,java.lang.Object> options)

markAlive

protected void markAlive(SourceRoute<Identifier> route,
                         java.util.Map<java.lang.String,java.lang.Object> options)
This method should be called when a known route is declared alive.

Parameters:
route - The now-live route

markSuspected

protected void markSuspected(SourceRoute<Identifier> route,
                             java.util.Map<java.lang.String,java.lang.Object> options)
This method should be called when a known route is declared suspected.

Parameters:
route - The now-suspected route

markDead

protected void markDead(SourceRoute<Identifier> deadRoute,
                        java.util.Map<java.lang.String,java.lang.Object> options)
This method should be called when a known route is declared dead.

Parameters:
route - The now-dead route

markDeadForever

protected void markDeadForever(java.util.Map<java.lang.String,java.lang.Object> options)
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<Identifier> route,
                             int proximity,
                             java.util.Map<java.lang.String,java.lang.Object> options)
This method should be called when a known route has its proximity updated

Parameters:
route - The route
proximity - The proximity

setAlive

protected void setAlive(java.util.Map<java.lang.String,java.lang.Object> options)
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(java.util.Map<java.lang.String,java.lang.Object> options)
Internal method which marks this address as being suspected.


setDead

protected void setDead(java.util.Map<java.lang.String,java.lang.Object> options)
Internal method which marks this address as being dead. If we were alive or suspected before, it sends an update out to the observers.


setDeadForever

protected void setDeadForever(java.util.Map<java.lang.String,java.lang.Object> options)
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()

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection