|
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.liveness.LivenessTransportLayerImpl<Identifier>
public class LivenessTransportLayerImpl<Identifier>
Nested Class Summary | |
---|---|
protected class |
LivenessTransportLayerImpl.DeadChecker
DESCRIBE THE CLASS |
class |
LivenessTransportLayerImpl.EntityManager
Internal class which is charges with managing the remote connection via a specific route |
Field Summary | |
---|---|
long |
BACKOFF_INITIAL
|
int |
BACKOFF_LIMIT
|
long |
CHECK_DEAD_THROTTLE
|
int |
DEFAULT_RTO
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 |
protected Environment |
environment
|
static byte |
HDR_NORMAL
Pass the msg to the callback if it is NORMAL |
static byte |
HDR_PING
|
static byte |
HDR_PONG
|
protected Logger |
logger
|
int |
NUM_PING_TRIES
|
int |
PING_DELAY
|
float |
PING_JITTER
|
protected java.util.Random |
random
|
protected TimeSource |
time
|
protected Timer |
timer
|
protected TransportLayer<Identifier,java.nio.ByteBuffer> |
tl
|
Fields inherited from interface org.mpisws.p2p.transport.liveness.LivenessTypes |
---|
LIVENESS_ALIVE, LIVENESS_DEAD, LIVENESS_DEAD_FOREVER, LIVENESS_SUSPECTED |
Constructor Summary | |
---|---|
LivenessTransportLayerImpl(TransportLayer<Identifier,java.nio.ByteBuffer> tl,
Environment env,
ErrorHandler<Identifier> errorHandler,
int checkDeadThrottle)
|
Method Summary | |
---|---|
void |
acceptMessages(boolean b)
Toggle accepting incoming messages. |
void |
acceptSockets(boolean b)
Toggle accepting new sockets. |
void |
addLivenessListener(LivenessListener<Identifier> name)
|
void |
addPingListener(PingListener<Identifier> name)
|
boolean |
cancelLivenessCheck(Identifier i,
java.util.Map<java.lang.String,java.lang.Object> options)
True if there was a pending liveness check. |
boolean |
cancelLivenessCheck(LivenessTransportLayerImpl.EntityManager manager,
java.util.Map<java.lang.String,java.lang.Object> options)
|
boolean |
checkLiveness(Identifier i,
java.util.Map<java.lang.String,java.lang.Object> options)
Returns whether a new notification will occur. |
void |
clearState(Identifier i)
Force layer to clear the existing state related to the Identifier. |
void |
connectionExceptionMeansFaulty(boolean b)
Set this to true if you want a ConnectionException to mark the connection as faulty. |
LivenessTransportLayerImpl.EntityManager |
deleteManager(Identifier i)
|
void |
destroy()
|
int |
getLiveness(Identifier i,
java.util.Map<java.lang.String,java.lang.Object> options)
|
Identifier |
getLocalIdentifier()
The local node. |
P2PSocket<Identifier> |
getLSocket(P2PSocket<Identifier> s,
LivenessTransportLayerImpl.EntityManager manager)
|
LivenessTransportLayerImpl.EntityManager |
getManager(Identifier i)
|
void |
incomingSocket(P2PSocket<Identifier> s)
Notification of a new socket. |
void |
messageReceived(Identifier i,
java.nio.ByteBuffer m,
java.util.Map<java.lang.String,java.lang.Object> options)
Called when a new message is received. |
SocketRequestHandle<Identifier> |
openSocket(Identifier i,
SocketCallback<Identifier> deliverSocketToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Open a socket to the Identifier |
boolean |
ping(Identifier i,
java.util.Map<java.lang.String,java.lang.Object> options)
Send the ping. |
void |
pong(Identifier i,
long senderTime,
java.util.Map<java.lang.String,java.lang.Object> options)
Send the pong(); |
boolean |
removeLivenessListener(LivenessListener<Identifier> name)
|
boolean |
removePingListener(PingListener<Identifier> name)
|
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)
Send the message to the identifier |
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. |
void |
setLiveness(Identifier i,
int liveness,
java.util.Map<java.lang.String,java.lang.Object> options)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final int PING_DELAY
public final float PING_JITTER
public final int NUM_PING_TRIES
public final long BACKOFF_INITIAL
public final int BACKOFF_LIMIT
public long CHECK_DEAD_THROTTLE
public int DEFAULT_RTO
protected TransportLayer<Identifier,java.nio.ByteBuffer> tl
protected Logger logger
protected Environment environment
protected TimeSource time
protected Timer timer
protected java.util.Random random
public static final byte HDR_NORMAL
public static final byte HDR_PING
public static final byte HDR_PONG
Constructor Detail |
---|
public LivenessTransportLayerImpl(TransportLayer<Identifier,java.nio.ByteBuffer> tl, Environment env, ErrorHandler<Identifier> errorHandler, int checkDeadThrottle)
Method Detail |
---|
public void clearState(Identifier i)
LivenessProvider
clearState
in interface LivenessProvider<Identifier>
public boolean checkLiveness(Identifier i, java.util.Map<java.lang.String,java.lang.Object> options)
LivenessProvider
checkLiveness
in interface LivenessProvider<Identifier>
i
- the node to check
public P2PSocket<Identifier> getLSocket(P2PSocket<Identifier> s, LivenessTransportLayerImpl.EntityManager manager)
public LivenessTransportLayerImpl.EntityManager getManager(Identifier i)
public LivenessTransportLayerImpl.EntityManager deleteManager(Identifier i)
public int getLiveness(Identifier i, java.util.Map<java.lang.String,java.lang.Object> options)
getLiveness
in interface LivenessProvider<Identifier>
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 connectionExceptionMeansFaulty(boolean b)
public SocketRequestHandle<Identifier> openSocket(Identifier i, SocketCallback<Identifier> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)
TransportLayer
openSocket
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
i
- who to open the socket todeliverSocketToMe
- the callback when the socket is openedoptions
- options on how to open the socket (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
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)
TransportLayer
sendMessage
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
i
- the destinationm
- the messagedeliverAckToMe
- layer dependent notification when the message is sent (can indicate placed on the wire, point-to-point acknowledgment, or end-to-end acknowledgement)options
- delivery options (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
public void messageReceived(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<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 boolean cancelLivenessCheck(Identifier i, java.util.Map<java.lang.String,java.lang.Object> options)
i
- options
-
public boolean cancelLivenessCheck(LivenessTransportLayerImpl.EntityManager manager, java.util.Map<java.lang.String,java.lang.Object> options)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean ping(Identifier i, java.util.Map<java.lang.String,java.lang.Object> options)
ping
in interface Pinger<Identifier>
i
- options
- transport layer dependent way to send the ping (udp/tcp etc)
public void pong(Identifier i, long senderTime, java.util.Map<java.lang.String,java.lang.Object> options)
i
- senderTime
- 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 incomingSocket(P2PSocket<Identifier> s) throws java.io.IOException
TransportLayerCallback
incomingSocket
in interface TransportLayerCallback<Identifier,java.nio.ByteBuffer>
s
- the incoming socket
java.io.IOException
public void addLivenessListener(LivenessListener<Identifier> name)
addLivenessListener
in interface LivenessProvider<Identifier>
public boolean removeLivenessListener(LivenessListener<Identifier> name)
removeLivenessListener
in interface LivenessProvider<Identifier>
public void addPingListener(PingListener<Identifier> name)
addPingListener
in interface Pinger<Identifier>
public boolean removePingListener(PingListener<Identifier> name)
removePingListener
in interface Pinger<Identifier>
public void setLiveness(Identifier i, int liveness, java.util.Map<java.lang.String,java.lang.Object> options)
setLiveness
in interface OverrideLiveness<Identifier>
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |