|
Rice Pastry API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--rice.pastry.wire.DatagramManager
This class is an implementation of a UDP-based Pastry protocol. All messages are sent across the network as datagrams. It uses a TransmissionManager in order to ensure (ordered) delivery.
Field Summary | |
static int |
DATAGRAM_RECEIVE_BUFFER_SIZE
|
static int |
DATAGRAM_SEND_BUFFER_SIZE
|
Constructor Summary | |
DatagramManager(rice.pastry.wire.WirePastryNode pastryNode,
rice.pastry.wire.SelectorManager manager,
int port)
Constructor. |
Method Summary | |
void |
accept(java.nio.channels.SelectionKey key)
Specified by the SelectionKeyHandler - should NEVER be called (since datagrams are never accepted). |
void |
connect(java.nio.channels.SelectionKey key)
Specified by the SelectionKeyHandler - should NEVER be called (since datagrams are never connected). |
static java.lang.Object |
deserialize(java.nio.ByteBuffer buffer)
Method which takes in a ByteBuffer read from a datagram, and deserializes the contained object. |
void |
read(java.nio.channels.SelectionKey key)
Specified by the SelectionKeyHandler interface - is called when there is a datagram ready to be read. |
void |
resetAckNumber(rice.pastry.NodeId node)
Designed to be called by a node handle when a socket is open in order to reset the seqence number of UDP. |
static java.nio.ByteBuffer |
serialize(java.lang.Object o)
Method which serializes a given object into a ByteBuffer, in order to prepare it for writing. |
void |
wakeup()
Called by the SelectorManager whenever it is awoken. |
void |
write(rice.pastry.NodeId destination,
java.net.InetSocketAddress address,
java.lang.Object o)
Method designed for node handles to use when they wish to write to their remote node. |
void |
write(java.nio.channels.SelectionKey key)
Specified by the SelectionKeyHandler interface - is called when there is space in the DatagramChannel's buffer to write some data. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static int DATAGRAM_RECEIVE_BUFFER_SIZE
public static int DATAGRAM_SEND_BUFFER_SIZE
Constructor Detail |
public DatagramManager(rice.pastry.wire.WirePastryNode pastryNode, rice.pastry.wire.SelectorManager manager, int port)
port
- The port number this Datagram Manager should run onMethod Detail |
public void resetAckNumber(rice.pastry.NodeId node)
node
- The NodeId to reset.public void write(rice.pastry.NodeId destination, java.net.InetSocketAddress address, java.lang.Object o)
address
- The remote address to send the message to.o
- The object that should be sent.public void read(java.nio.channels.SelectionKey key)
read
in interface SelectionKeyHandler
key
- The SelectionKey which is readable.public void write(java.nio.channels.SelectionKey key)
write
in interface SelectionKeyHandler
key
- The key which is writablepublic void wakeup()
wakeup
in interface SelectionKeyHandler
public static java.nio.ByteBuffer serialize(java.lang.Object o) throws java.io.IOException
o
- The object to serialize
java.io.IOException
public static java.lang.Object deserialize(java.nio.ByteBuffer buffer) throws java.io.IOException
buffer
- The buffer read from the datagram.
java.io.IOException
public void accept(java.nio.channels.SelectionKey key)
accept
in interface SelectionKeyHandler
key
- The key that is acceptable.public void connect(java.nio.channels.SelectionKey key)
connect
in interface SelectionKeyHandler
key
- The key that is connectable.
|
Rice Pastry API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |