|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrice.pastry.socket.SocketSourceRouteManager
public class SocketSourceRouteManager
Class which keeps track of the best routes to remote nodes. This class is also therefore in charge of declaring node death and liveness.
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. |
SocketNodeHandle |
coalesce(SocketNodeHandle 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()
|
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 |
---|
public long CHECK_DEAD_THROTTLE
public long PING_THROTTLE
public int NUM_SOURCE_ROUTE_ATTEMPTS
public int PROX_TIMEOUT
public int DEFAULT_RTO
Constructor Detail |
---|
protected SocketSourceRouteManager(SocketPastryNode node, EpochInetSocketAddress bindAddress, EpochInetSocketAddress proxyAddress, RandomSource random) throws java.io.IOException
node
- The local nodebindAddress
- The address which the node should bind toproxyAddress
- The address which the node should advertise as it's
addressrandom
- DESCRIBE THE PARAMETER
java.io.IOException
- DESCRIBE THE EXCEPTIONMethod Detail |
---|
public java.util.HashMap getBest()
public SocketCollectionManager getManager()
protected SocketSourceRouteManager.AddressManager getAddressManager(EpochInetSocketAddress address, boolean search)
address
- The remote addresssearch
- DESCRIBE THE PARAMETER
public SocketNodeHandle getNodeHandle(EpochInetSocketAddress address)
address
- DESCRIBE THE PARAMETER
public SocketSourceRouteManager.AddressManager getAddressManager(EpochInetSocketAddress address)
address
- DESCRIBE THE PARAMETER
public int getLiveness(EpochInetSocketAddress address)
address
- The address to return the value for
protected SourceRoute[] getAllRoutes(EpochInetSocketAddress destination)
destination
- DESCRIBE THE PARAMETER
protected SourceRoute getBestRoute(EpochInetSocketAddress address)
address
- The address
public void destroy() throws java.io.IOException
java.io.IOException
- DESCRIBE THE EXCEPTIONpublic SocketNodeHandle coalesce(SocketNodeHandle newHandle)
newHandle
- DESCRIBE THE PARAMETER
public SocketSourceRouteManager.AddressManager putAddressManager(EpochInetSocketAddress address, boolean search)
address
- search
- DESCRIBE THE PARAMETER
public void bootstrap(EpochInetSocketAddress address, Message msg) throws java.io.IOException
address
- The address to send the message tomsg
- DESCRIBE THE PARAMETER
java.io.IOException
- DESCRIBE THE EXCEPTIONpublic void send(EpochInetSocketAddress address, Message msg) throws java.io.IOException
address
- DESCRIBE THE PARAMETERmsg
- DESCRIBE THE PARAMETER
java.io.IOException
- DESCRIBE THE EXCEPTIONpublic void send(EpochInetSocketAddress address, SocketBuffer message)
address
- The address to send the message tomessage
- The message to sendpublic void connect(EpochInetSocketAddress address, int appAddress, AppSocketReceiver receiver, int timeout)
address
- The address to send the message toappAddress
- DESCRIBE THE PARAMETERreceiver
- DESCRIBE THE PARAMETERtimeout
- DESCRIBE THE PARAMETERpublic void ping(EpochInetSocketAddress address)
address
- DESCRIBE THE PARAMETERpublic void checkLiveness(EpochInetSocketAddress address)
address
- DESCRIBE THE PARAMETERpublic int proximity(EpochInetSocketAddress address)
address
- The address to return the value for
protected void markDead(SourceRoute route)
route
- The now-dead routeprotected void markDead(EpochInetSocketAddress address)
address
- The now-dead addressprotected void markAlive(SourceRoute route)
route
- The now-live routeprotected int proximity(SourceRoute route)
route
- DESCRIBE THE PARAMETER
protected int rto(SourceRoute route)
route
- DESCRIBE THE PARAMETER
protected void markSuspected(SourceRoute route)
route
- The now-live routeprotected void markProximity(SourceRoute route, int proximity)
route
- The routeproximity
- The proximityprotected void reroute(EpochInetSocketAddress address, SocketBuffer m)
address
- The address of the remote nodem
- The message
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |