|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mpisws.p2p.transport.sourceroute.manager.SourceRouteManagerImpl<Identifier>
public class SourceRouteManagerImpl<Identifier>
This class adapts a SourceRoute transport layer back to an Identifier layer. It does this by selecting an appropriate source route from a SourceRouteStrategy, which generates SourceRoutes to try.
Nested Class Summary | |
---|---|
protected class |
SourceRouteManagerImpl.AddressManager
Internal class which is tasked with maintaining the status of a single remote address. |
Field Summary | |
---|---|
int |
CHECK_LIVENESS_THROTTLE
|
static int |
DEFAULT_PROXIMITY
|
int |
NUM_SOURCE_ROUTE_ATTEMPTS
|
long |
PING_THROTTLE
|
Fields inherited from interface org.mpisws.p2p.transport.liveness.LivenessTypes |
---|
LIVENESS_ALIVE, LIVENESS_DEAD, LIVENESS_DEAD_FOREVER, LIVENESS_SUSPECTED |
Constructor Summary | |
---|---|
SourceRouteManagerImpl(SourceRouteFactory<Identifier> srFactory,
TransportLayer<SourceRoute<Identifier>,java.nio.ByteBuffer> tl,
LivenessProvider<SourceRoute<Identifier>> livenessProvider,
ProximityProvider<SourceRoute<Identifier>> proxProvider,
Environment env,
SourceRouteStrategy<Identifier> strategy)
|
Method Summary | |
---|---|
void |
acceptMessages(boolean b)
Toggle accepting incoming messages. |
void |
acceptSockets(boolean b)
Toggle accepting new sockets. |
void |
addHardLink(SourceRouteManagerImpl.AddressManager am)
|
void |
addLivenessListener(LivenessListener<Identifier> name)
|
void |
addProximityListener(ProximityListener<Identifier> listener)
|
boolean |
checkLiveness(Identifier address,
java.util.Map<java.lang.String,java.lang.Object> options)
Method which FORCES a check of liveness of the remote node. |
void |
clearState(Identifier i)
Force layer to clear the existing state related to the Identifier. |
void |
destroy()
|
protected SourceRouteManagerImpl.AddressManager |
getAddressManager(Identifier address)
Internal method which returns (or builds) the manager associated with an address |
int |
getLiveness(Identifier address,
java.util.Map<java.lang.String,java.lang.Object> options)
Method which returns the last cached liveness value for the given address. |
Identifier |
getLocalIdentifier()
The local node. |
void |
incomingSocket(P2PSocket<SourceRoute<Identifier>> s)
Notification of a new socket. |
void |
livenessChanged(SourceRoute<Identifier> i,
int val,
java.util.Map<java.lang.String,java.lang.Object> options)
Called when the liveness changes. |
void |
messageReceived(SourceRoute<Identifier> i,
java.nio.ByteBuffer m,
java.util.Map<java.lang.String,java.lang.Object> options)
Called when a new message is received. |
void |
notifyProximityListeners(Identifier i,
int prox,
java.util.Map<java.lang.String,java.lang.Object> options)
|
SocketRequestHandle<Identifier> |
openSocket(Identifier i,
SocketCallback<Identifier> deliverSocketToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Method which sends a message across the wire. |
int |
proximity(Identifier address,
java.util.Map<java.lang.String,java.lang.Object> options)
Method which returns the last cached proximity value for the given address. |
void |
proximityChanged(SourceRoute<Identifier> i,
int newProximity,
java.util.Map<java.lang.String,java.lang.Object> options)
|
void |
removeHardLink(SourceRouteManagerImpl.AddressManager am)
|
boolean |
removeLivenessListener(LivenessListener<Identifier> name)
|
boolean |
removeProximityListener(ProximityListener<Identifier> listener)
|
MessageRequestHandle<Identifier,java.nio.ByteBuffer> |
sendMessage(Identifier i,
java.nio.ByteBuffer m,
MessageCallback<Identifier,java.nio.ByteBuffer> deliverAckToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Method which sends a message across the wire. |
void |
setCallback(TransportLayerCallback<Identifier,java.nio.ByteBuffer> callback)
Set the callback for incoming sockets/messages |
void |
setErrorHandler(ErrorHandler<Identifier> handler)
To be notified of problems not related to an outgoing messaage/socket. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_PROXIMITY
public long PING_THROTTLE
public int NUM_SOURCE_ROUTE_ATTEMPTS
public int CHECK_LIVENESS_THROTTLE
Constructor Detail |
---|
public SourceRouteManagerImpl(SourceRouteFactory<Identifier> srFactory, TransportLayer<SourceRoute<Identifier>,java.nio.ByteBuffer> tl, LivenessProvider<SourceRoute<Identifier>> livenessProvider, ProximityProvider<SourceRoute<Identifier>> proxProvider, Environment env, SourceRouteStrategy<Identifier> strategy)
Method Detail |
---|
public MessageRequestHandle<Identifier,java.nio.ByteBuffer> sendMessage(Identifier i, java.nio.ByteBuffer m, MessageCallback<Identifier,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
sendMessage
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
message
- The message to sendaddress
- The address to send the message to
protected SourceRouteManagerImpl.AddressManager getAddressManager(Identifier address)
address
- The remote addresspublic void clearState(Identifier i)
LivenessProvider
clearState
in interface LivenessProvider<Identifier>
clearState
in interface ProximityProvider<Identifier>
public void addHardLink(SourceRouteManagerImpl.AddressManager am)
public void removeHardLink(SourceRouteManagerImpl.AddressManager am)
public SocketRequestHandle<Identifier> openSocket(Identifier i, SocketCallback<Identifier> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)
openSocket
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
message
- The message to sendaddress
- The address to send the message to
public boolean checkLiveness(Identifier address, java.util.Map<java.lang.String,java.lang.Object> options)
checkLiveness
in interface LivenessProvider<Identifier>
address
- the node to check
public int getLiveness(Identifier address, java.util.Map<java.lang.String,java.lang.Object> options)
getLiveness
in interface LivenessProvider<Identifier>
address
- The address to return the value for
public int proximity(Identifier address, java.util.Map<java.lang.String,java.lang.Object> options)
proximity
in interface ProximityProvider<Identifier>
address
- The address to return the value for
public void acceptMessages(boolean b)
TransportLayer
acceptMessages
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
public void acceptSockets(boolean b)
TransportLayer
acceptSockets
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
public Identifier getLocalIdentifier()
TransportLayer
getLocalIdentifier
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
public void setCallback(TransportLayerCallback<Identifier,java.nio.ByteBuffer> callback)
TransportLayer
setCallback
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
callback
- the callback for incoming sockets/messagespublic void setErrorHandler(ErrorHandler<Identifier> handler)
TransportLayer
setErrorHandler
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
handler
- to be notified of problems not related to a specific messaage/socket.public void destroy()
destroy
in interface Destructable
public void addLivenessListener(LivenessListener<Identifier> name)
addLivenessListener
in interface LivenessProvider<Identifier>
public boolean removeLivenessListener(LivenessListener<Identifier> name)
removeLivenessListener
in interface LivenessProvider<Identifier>
public void incomingSocket(P2PSocket<SourceRoute<Identifier>> s) throws java.io.IOException
TransportLayerCallback
incomingSocket
in interface TransportLayerCallback<SourceRoute<Identifier>,java.nio.ByteBuffer>
s
- the incoming socket
java.io.IOException
public void messageReceived(SourceRoute<Identifier> i, java.nio.ByteBuffer m, java.util.Map<java.lang.String,java.lang.Object> options) throws java.io.IOException
TransportLayerCallback
messageReceived
in interface TransportLayerCallback<SourceRoute<Identifier>,java.nio.ByteBuffer>
i
- The node it is coming fromm
- the messageoptions
- describe how the message arrived (udp/tcp, encrypted etc)
java.io.IOException
- if there is a problem decoding the messagepublic void livenessChanged(SourceRoute<Identifier> i, int val, java.util.Map<java.lang.String,java.lang.Object> options)
LivenessListener
livenessChanged
in interface LivenessListener<SourceRoute<Identifier>>
public void addProximityListener(ProximityListener<Identifier> listener)
addProximityListener
in interface ProximityProvider<Identifier>
public boolean removeProximityListener(ProximityListener<Identifier> listener)
removeProximityListener
in interface ProximityProvider<Identifier>
public void proximityChanged(SourceRoute<Identifier> i, int newProximity, java.util.Map<java.lang.String,java.lang.Object> options)
proximityChanged
in interface ProximityListener<SourceRoute<Identifier>>
public void notifyProximityListeners(Identifier i, int prox, java.util.Map<java.lang.String,java.lang.Object> options)
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |