|
Rice Pastry API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectrice.selector.SelectionKeyHandler
rice.pastry.socket.PingManager
| Nested Class Summary | |
class |
PingManager.Envelope
Internal class which holds a pending datagram |
| Field Summary | |
int |
DATAGRAM_RECEIVE_BUFFER_SIZE
DESCRIBE THE FIELD |
int |
DATAGRAM_SEND_BUFFER_SIZE
DESCRIBE THE FIELD |
protected static byte[] |
HEADER_PING
DESCRIBE THE FIELD |
protected static byte[] |
HEADER_SHORT_PING
DESCRIBE THE FIELD |
protected static byte[] |
HEADER_SHORT_PING_RESPONSE
DESCRIBE THE FIELD |
static int |
HEADER_SIZE
DESCRIBE THE FIELD |
protected java.util.WeakHashMap |
lastPingTime
DESCRIBE THE FIELD |
protected java.util.ArrayList |
pendingMsgs
DESCRIBE THE FIELD |
static int |
PING_THROTTLE
DESCRIBE THE FIELD |
protected java.util.WeakHashMap |
pingListeners
DESCRIBE THE FIELD |
boolean |
USE_SHORT_PINGS
DESCRIBE THE FIELD |
| Constructor Summary | |
PingManager(SocketPastryNode spn,
SocketSourceRouteManager manager,
EpochInetSocketAddress bindAddress,
EpochInetSocketAddress proxyAddress)
|
|
| Method Summary | |
static byte[] |
addHeader(SourceRoute path,
java.lang.Object data,
EpochInetSocketAddress localAddress,
Environment env,
Logger logger)
Method which adds a header for the provided path to the given data. |
protected void |
addPingResponseListener(SourceRoute path,
PingResponseListener prl)
Adds a feature to the PingResponseListener attribute of the PingManager object |
SourceRoute |
decodeHeader(byte[] header)
Method which adds a header for the provided path to the given data. |
static java.lang.Object |
deserialize(byte[] array,
Environment env,
SocketPastryNode spn,
Logger logger)
Method which takes in a ByteBuffer read from a datagram, and deserializes the contained object. |
void |
enqueue(SourceRoute path,
java.lang.Object msg)
DESCRIBE THE METHOD |
void |
modifyKey(java.nio.channels.SelectionKey key)
DESCRIBE THE METHOD |
protected void |
notifyPingResponseListeners(SourceRoute path,
int proximity,
long lastTimePinged)
caller must synchronized(pingResponseTimes) |
protected void |
ping(SourceRoute path,
PingResponseListener prl)
Method which actually sends a ping to over the specified path, and returns the result to the specified listener. |
void |
read(java.nio.channels.SelectionKey key)
DESCRIBE THE METHOD |
protected void |
readHeader(java.net.InetSocketAddress address)
Method which processes an incoming message and hands it off to the appropriate handler. |
void |
receiveMessage(java.lang.Object message,
int size,
java.net.InetSocketAddress from)
DESCRIBE THE METHOD |
protected void |
removePingResponseListener(SourceRoute path,
PingResponseListener prl)
Adds a feature to the PingResponseListener attribute of the PingManager object |
protected void |
resign()
Makes this node resign from the network. |
protected void |
sendShortPing(SourceRoute route)
Builds the data for a short ping |
static byte[] |
serialize(java.lang.Object message,
Environment environment,
Logger logger)
Method which serializes a given object into a ByteBuffer, in order to prepare it for writing. |
protected void |
shortPingReceived(SourceRoute route,
byte[] payload)
Builds the data for a short ping response |
protected void |
shortPingResponseReceived(SourceRoute route,
byte[] payload)
Processes a short ping response |
void |
stall()
Internal testing method which simulates a stall. |
void |
write(java.nio.channels.SelectionKey key)
DESCRIBE THE METHOD |
| Methods inherited from class rice.selector.SelectionKeyHandler |
accept, connect |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public final boolean USE_SHORT_PINGS
public final int DATAGRAM_RECEIVE_BUFFER_SIZE
public final int DATAGRAM_SEND_BUFFER_SIZE
protected java.util.WeakHashMap pingListeners
protected java.util.WeakHashMap lastPingTime
protected java.util.ArrayList pendingMsgs
public static final int PING_THROTTLE
protected static byte[] HEADER_PING
protected static byte[] HEADER_SHORT_PING
protected static byte[] HEADER_SHORT_PING_RESPONSE
public static int HEADER_SIZE
| Constructor Detail |
public PingManager(SocketPastryNode spn,
SocketSourceRouteManager manager,
EpochInetSocketAddress bindAddress,
EpochInetSocketAddress proxyAddress)
manager - DESCRIBE THE PARAMETERspn - DESCRIBE THE PARAMETERbindAddress - DESCRIBE THE PARAMETERproxyAddress - DESCRIBE THE PARAMETER| Method Detail |
protected void ping(SourceRoute path,
PingResponseListener prl)
path - The path to send the ping overprl - The listener which should hear about the response
protected void resign()
throws java.io.IOException
java.io.IOException - DESCRIBE THE EXCEPTIONpublic void stall()
protected void sendShortPing(SourceRoute route)
route - DESCRIBE THE PARAMETER
protected void shortPingReceived(SourceRoute route,
byte[] payload)
throws java.io.IOException
route - DESCRIBE THE PARAMETERpayload - DESCRIBE THE PARAMETER
java.io.IOException - DESCRIBE THE EXCEPTION
protected void shortPingResponseReceived(SourceRoute route,
byte[] payload)
throws java.io.IOException
route - DESCRIBE THE PARAMETERpayload - DESCRIBE THE PARAMETER
java.io.IOException - DESCRIBE THE EXCEPTION
protected void removePingResponseListener(SourceRoute path,
PingResponseListener prl)
prl - The feature to be added to the PingResponseListener attributepath - DESCRIBE THE PARAMETER
protected void addPingResponseListener(SourceRoute path,
PingResponseListener prl)
prl - The feature to be added to the PingResponseListener attributepath - The feature to be added to the PingResponseListener attribute
protected void notifyPingResponseListeners(SourceRoute path,
int proximity,
long lastTimePinged)
proximity - lastTimePinged - path - DESCRIBE THE PARAMETER
public void enqueue(SourceRoute path,
java.lang.Object msg)
msg - DESCRIBE THE PARAMETERpath - DESCRIBE THE PARAMETER
public void receiveMessage(java.lang.Object message,
int size,
java.net.InetSocketAddress from)
throws java.io.IOException
message - DESCRIBE THE PARAMETERsize - DESCRIBE THE PARAMETERfrom - DESCRIBE THE PARAMETER
java.io.IOException - DESCRIBE THE EXCEPTIONpublic void read(java.nio.channels.SelectionKey key)
read in class SelectionKeyHandlerkey - DESCRIBE THE PARAMETERpublic void write(java.nio.channels.SelectionKey key)
write in class SelectionKeyHandlerkey - DESCRIBE THE PARAMETERpublic void modifyKey(java.nio.channels.SelectionKey key)
modifyKey in class SelectionKeyHandlerkey - DESCRIBE THE PARAMETER
public SourceRoute decodeHeader(byte[] header)
throws java.io.IOException
header - DESCRIBE THE PARAMETER
java.io.IOException - DESCRIBE THE EXCEPTION
protected void readHeader(java.net.InetSocketAddress address)
throws java.io.IOException
address - DESCRIBE THE PARAMETER
java.io.IOException - DESCRIBE THE EXCEPTION
public static byte[] serialize(java.lang.Object message,
Environment environment,
Logger logger)
throws java.io.IOException
message - DESCRIBE THE PARAMETERenvironment - DESCRIBE THE PARAMETERlogger - DESCRIBE THE PARAMETER
java.io.IOException - if the object can't be serialized
public static java.lang.Object deserialize(byte[] array,
Environment env,
SocketPastryNode spn,
Logger logger)
throws java.io.IOException
array - DESCRIBE THE PARAMETERenv - DESCRIBE THE PARAMETERspn - DESCRIBE THE PARAMETERlogger - DESCRIBE THE PARAMETER
java.io.IOException - if the buffer can't be deserialized
public static byte[] addHeader(SourceRoute path,
java.lang.Object data,
EpochInetSocketAddress localAddress,
Environment env,
Logger logger)
throws java.io.IOException
path - The feature to be added to the Header attributedata - The feature to be added to the Header attributelocalAddress - The feature to be added to the Header attributeenv - The feature to be added to the Header attributelogger - The feature to be added to the Header attribute
java.io.IOException - DESCRIBE THE EXCEPTION
|
Rice Pastry API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||