Rice Pastry API

org.mpisws.p2p.transport.sourceroute.manager
Class SourceRouteManagerP2PSocket<Identifier>

java.lang.Object
  extended by org.mpisws.p2p.transport.sourceroute.manager.SourceRouteManagerP2PSocket<Identifier>
All Implemented Interfaces:
P2PSocket<Identifier>

public class SourceRouteManagerP2PSocket<Identifier>
extends java.lang.Object
implements P2PSocket<Identifier>


Constructor Summary
SourceRouteManagerP2PSocket(P2PSocket<SourceRoute<Identifier>> socket, Environment env)
           
 
Method Summary
 void close()
          Closes this socket.
 Identifier getIdentifier()
          The identification of the node at the other end of the socket.
 java.util.Map<java.lang.String,java.lang.Integer> getOptions()
          Details on the connectivity of the socket (encrypted, source-routed etc)
 long read(java.nio.ByteBuffer dsts)
          Reads a sequence of bytes from this channel into a subsequence of the given buffer.
 long read(java.nio.ByteBuffer[] dsts, int offset, int length)
          Reads a sequence of bytes from this channel into a subsequence of the given buffers.
 void register(boolean wantToRead, boolean wantToWrite, P2PSocketReceiver<Identifier> receiver)
          Must be called every time a Read/Write occurs to continue operation.
 void shutdownOutput()
          Disables the output stream for this socket.
 java.lang.String toString()
           
 long write(java.nio.ByteBuffer srcs)
          Writes a sequence of bytes to this channel from a subsequence of the given buffers.
 long write(java.nio.ByteBuffer[] srcs, int offset, int length)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SourceRouteManagerP2PSocket

public SourceRouteManagerP2PSocket(P2PSocket<SourceRoute<Identifier>> socket,
                                   Environment env)
Method Detail

close

public void close()
Description copied from interface: P2PSocket
Closes this socket.

Specified by:
close in interface P2PSocket<Identifier>

getIdentifier

public Identifier getIdentifier()
Description copied from interface: P2PSocket
The identification of the node at the other end of the socket.

Specified by:
getIdentifier in interface P2PSocket<Identifier>
Returns:
The identification of the node at the other end of the socket.

read

public long read(java.nio.ByteBuffer dsts)
          throws java.io.IOException
Description copied from interface: P2PSocket
Reads a sequence of bytes from this channel into a subsequence of the given buffer.

Specified by:
read in interface P2PSocket<Identifier>
Returns:
Throws:
java.io.IOException

read

public long read(java.nio.ByteBuffer[] dsts,
                 int offset,
                 int length)
          throws java.io.IOException
Description copied from interface: P2PSocket
Reads a sequence of bytes from this channel into a subsequence of the given buffers.

Specified by:
read in interface P2PSocket<Identifier>
Returns:
Throws:
java.io.IOException

register

public void register(boolean wantToRead,
                     boolean wantToWrite,
                     P2PSocketReceiver<Identifier> receiver)
Description copied from interface: P2PSocket
Must be called every time a Read/Write occurs to continue operation. Can cancel this task by calling with null.

Specified by:
register in interface P2PSocket<Identifier>
Parameters:
wantToRead - if you want to read from this socket
wantToWrite - if you want to write to this socket
receiver - will have receiveSelectResult() called on it note that you must call select() each time receiveSelectResult() is called. This is so your application can properly handle flow control

shutdownOutput

public void shutdownOutput()
Description copied from interface: P2PSocket
Disables the output stream for this socket. Used to properly close down a socket used for bi-directional communication that can be initated by either side.

Specified by:
shutdownOutput in interface P2PSocket<Identifier>

write

public long write(java.nio.ByteBuffer srcs)
           throws java.io.IOException
Description copied from interface: P2PSocket
Writes a sequence of bytes to this channel from a subsequence of the given buffers.

Specified by:
write in interface P2PSocket<Identifier>
Throws:
java.io.IOException

write

public long write(java.nio.ByteBuffer[] srcs,
                  int offset,
                  int length)
           throws java.io.IOException
Specified by:
write in interface P2PSocket<Identifier>
Throws:
java.io.IOException

getOptions

public java.util.Map<java.lang.String,java.lang.Integer> getOptions()
Description copied from interface: P2PSocket
Details on the connectivity of the socket (encrypted, source-routed etc)

Specified by:
getOptions in interface P2PSocket<Identifier>
Returns:
a read-only list of options on this socket

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection