|
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 | |
static int |
DATAGRAM_RECEIVE_BUFFER_SIZE
DESCRIBE THE FIELD |
static int |
DATAGRAM_SEND_BUFFER_SIZE
DESCRIBE THE FIELD |
protected static byte[] |
HEADER_PING
DESCRIBE THE FIELD |
static int |
HEADER_SIZE
DESCRIBE THE FIELD |
protected java.util.ArrayList |
pendingMsgs
DESCRIBE THE FIELD |
static int |
PING_THROTTLE
DESCRIBE THE FIELD |
protected java.util.Hashtable |
pingListeners
DESCRIBE THE FIELD |
Constructor Summary | |
PingManager(SocketNodeHandlePool pool,
SocketSourceRouteManager manager,
PastryNode spn,
EpochInetSocketAddress bindAddress,
EpochInetSocketAddress proxyAddress)
|
Method Summary | |
static byte[] |
addHeader(SourceRoute path,
java.lang.Object data,
EpochInetSocketAddress localAddress)
Method which adds a header for the provided path to the given data. |
void |
addPingResponseListener(SourceRoute path,
PingResponseListener prl)
Adds a feature to the PingResponseListener attribute of the PingManager object |
static java.lang.Object |
deserialize(byte[] array)
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 |
protected void |
forcePing(SourceRoute path,
PingResponseListener prl)
DESCRIBE THE METHOD |
long |
getLastTimeHeardFrom(SourceRoute path)
Gets the LastTimeHeardFrom attribute of the PingManager object |
long |
getLastTimePinged(SourceRoute path)
Gets the LastTimePinged attribute of the PingManager object |
void |
modifyKey(java.nio.channels.SelectionKey key)
DESCRIBE THE METHOD |
protected void |
notifyPingResponseListeners(SourceRoute path,
int proximity,
long lastTimePinged)
caller must synchronized(pingResponseTimes) |
void |
ping(SourceRoute path,
PingResponseListener prl)
Method which initiates a ping to the remote node. |
void |
pingResponse(SourceRoute path,
long curTime)
DESCRIBE THE METHOD |
int |
proximity(SourceRoute path)
Method which returns the last cached proximity value for the given address. |
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 |
resetLastTimePinged(SourceRoute path)
Resets the last pinged time, only should be called when a node is marked dead. |
void |
resign()
Makes this node resign from the network. |
static byte[] |
serialize(java.lang.Object message)
Method which serializes a given object into a ByteBuffer, in order to prepare it for writing. |
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 |
protected java.util.Hashtable pingListeners
protected java.util.ArrayList pendingMsgs
protected static byte[] HEADER_PING
public static int HEADER_SIZE
public static int DATAGRAM_RECEIVE_BUFFER_SIZE
public static int DATAGRAM_SEND_BUFFER_SIZE
public static int PING_THROTTLE
Constructor Detail |
public PingManager(SocketNodeHandlePool pool, SocketSourceRouteManager manager, PastryNode spn, EpochInetSocketAddress bindAddress, EpochInetSocketAddress proxyAddress)
manager
- DESCRIBE THE PARAMETERpool
- DESCRIBE THE PARAMETERspn
- DESCRIBE THE PARAMETERbindAddress
- DESCRIBE THE PARAMETERproxyAddress
- DESCRIBE THE PARAMETERMethod Detail |
public long getLastTimePinged(SourceRoute path)
path
- DESCRIBE THE PARAMETER
public long getLastTimeHeardFrom(SourceRoute path)
path
- DESCRIBE THE PARAMETER
public void resign() throws java.io.IOException
java.io.IOException
- DESCRIBE THE EXCEPTIONprotected void resetLastTimePinged(SourceRoute path)
path
- DESCRIBE THE PARAMETERpublic int proximity(SourceRoute path)
path
- DESCRIBE THE PARAMETER
public void addPingResponseListener(SourceRoute path, PingResponseListener prl)
prl
- The feature to be added to the PingResponseListener attributepath
- The feature to be added to the PingResponseListener attributepublic void enqueue(SourceRoute path, java.lang.Object msg)
msg
- DESCRIBE THE PARAMETERpath
- DESCRIBE THE PARAMETERpublic 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 pingResponse(SourceRoute path, long curTime)
curTime
- DESCRIBE THE PARAMETERpath
- DESCRIBE THE PARAMETERpublic void write(java.nio.channels.SelectionKey key)
write
in class SelectionKeyHandler
key
- DESCRIBE THE PARAMETERpublic void modifyKey(java.nio.channels.SelectionKey key)
modifyKey
in class SelectionKeyHandler
key
- DESCRIBE THE PARAMETERpublic void read(java.nio.channels.SelectionKey key)
read
in class SelectionKeyHandler
key
- DESCRIBE THE PARAMETERpublic void ping(SourceRoute path, PingResponseListener prl)
prl
- DESCRIBE THE PARAMETERpath
- DESCRIBE THE PARAMETERprotected void forcePing(SourceRoute path, PingResponseListener prl)
prl
- DESCRIBE THE PARAMETERpath
- DESCRIBE THE PARAMETERprotected void notifyPingResponseListeners(SourceRoute path, int proximity, long lastTimePinged)
proximity
- lastTimePinged
- path
- DESCRIBE THE PARAMETERprotected void readHeader(java.net.InetSocketAddress address) throws java.io.IOException
address
- DESCRIBE THE PARAMETER
java.io.IOException
- DESCRIBE THE EXCEPTIONpublic static byte[] serialize(java.lang.Object message) throws java.io.IOException
message
- DESCRIBE THE PARAMETER
java.io.IOException
- if the object can't be serializedpublic static byte[] addHeader(SourceRoute path, java.lang.Object data, EpochInetSocketAddress localAddress) 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 attribute
java.io.IOException
- DESCRIBE THE EXCEPTIONpublic static java.lang.Object deserialize(byte[] array) throws java.io.IOException
array
- DESCRIBE THE PARAMETER
java.io.IOException
- if the buffer can't be deserialized
|
Rice Pastry API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |