|
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.util.SocketWrapperSocket<Identifier,SubIdentifier>
Identifier
- SubIdentifier
- public class SocketWrapperSocket<Identifier,SubIdentifier>
Just maps a socket from one form into another.
Field Summary | |
---|---|
protected ErrorHandler<Identifier> |
errorHandler
|
protected Identifier |
identifier
|
protected Logger |
logger
|
protected java.util.Map<java.lang.String,java.lang.Object> |
options
|
protected P2PSocketReceiver<Identifier> |
reader
|
protected P2PSocket<SubIdentifier> |
socket
|
protected P2PSocketReceiver<Identifier> |
writer
|
Constructor Summary | |
---|---|
SocketWrapperSocket(Identifier identifier,
P2PSocket<SubIdentifier> socket,
Logger logger,
ErrorHandler<Identifier> errorHandler,
java.util.Map<java.lang.String,java.lang.Object> options)
|
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.Object> |
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. |
void |
receiveException(P2PSocket<SubIdentifier> socket,
java.lang.Exception e)
Called when there is an error |
void |
receiveSelectResult(P2PSocket<SubIdentifier> socket,
boolean canRead,
boolean canWrite)
Called when a socket is available for read/write |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Identifier identifier
protected P2PSocket<SubIdentifier> socket
protected Logger logger
protected java.util.Map<java.lang.String,java.lang.Object> options
protected P2PSocketReceiver<Identifier> reader
protected P2PSocketReceiver<Identifier> writer
protected ErrorHandler<Identifier> errorHandler
Constructor Detail |
---|
public SocketWrapperSocket(Identifier identifier, P2PSocket<SubIdentifier> socket, Logger logger, ErrorHandler<Identifier> errorHandler, java.util.Map<java.lang.String,java.lang.Object> options)
Method Detail |
---|
public Identifier getIdentifier()
P2PSocket
getIdentifier
in interface P2PSocket<Identifier>
public void close()
P2PSocket
close
in interface P2PSocket<Identifier>
public long read(java.nio.ByteBuffer dsts) throws java.io.IOException
P2PSocket
read
in interface P2PSocket<Identifier>
java.io.IOException
public void register(boolean wantToRead, boolean wantToWrite, P2PSocketReceiver<Identifier> receiver)
P2PSocket
register
in interface P2PSocket<Identifier>
wantToRead
- if you want to read from this socketwantToWrite
- if you want to write to this socketreceiver
- 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 controlpublic void receiveSelectResult(P2PSocket<SubIdentifier> socket, boolean canRead, boolean canWrite) throws java.io.IOException
P2PSocketReceiver
receiveSelectResult
in interface P2PSocketReceiver<SubIdentifier>
java.io.IOException
public void receiveException(P2PSocket<SubIdentifier> socket, java.lang.Exception e)
P2PSocketReceiver
receiveException
in interface P2PSocketReceiver<SubIdentifier>
public void shutdownOutput()
P2PSocket
shutdownOutput
in interface P2PSocket<Identifier>
public long write(java.nio.ByteBuffer srcs) throws java.io.IOException
P2PSocket
write
in interface P2PSocket<Identifier>
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Map<java.lang.String,java.lang.Object> getOptions()
P2PSocket
getOptions
in interface P2PSocket<Identifier>
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |