org.mpisws.p2p.transport.peerreview.replay.record
Class RecordSocket<Identifier>
java.lang.Object
org.mpisws.p2p.transport.util.SocketWrapperSocket<Identifier,Identifier>
org.mpisws.p2p.transport.peerreview.replay.record.RecordSocket<Identifier>
- All Implemented Interfaces:
- P2PSocket<Identifier>, P2PSocketReceiver<Identifier>, PeerReviewEvents
public class RecordSocket<Identifier>
- extends SocketWrapperSocket<Identifier,Identifier>
- implements PeerReviewEvents
Fields inherited from interface org.mpisws.p2p.transport.peerreview.PeerReviewEvents |
EVT_ACK, EVT_CHECKPOINT, EVT_INIT, EVT_MAX_SOCKET_EVT, EVT_MIN_SOCKET_EVT, EVT_RECV, EVT_SEND, EVT_SENDSIGN, EVT_SIGN, EVT_SOCKET_CAN_READ, EVT_SOCKET_CAN_RW, EVT_SOCKET_CAN_WRITE, EVT_SOCKET_CLOSE, EVT_SOCKET_CLOSED, EVT_SOCKET_EXCEPTION, EVT_SOCKET_OPEN_INCOMING, EVT_SOCKET_OPEN_OUTGOING, EVT_SOCKET_OPENED_OUTGOING, EVT_SOCKET_READ, EVT_SOCKET_SHUTDOWN_OUTPUT, EVT_SOCKET_WRITE, EX_TYPE_ClosedChannel, EX_TYPE_IO, EX_TYPE_Unknown |
Method Summary |
void |
close()
Closes this socket. |
long |
read(java.nio.ByteBuffer dsts)
Reads a sequence of bytes from this channel into a subsequence of the given buffer. |
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. |
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 |
RecordSocket
public RecordSocket(Identifier identifier,
P2PSocket<Identifier> socket,
Logger logger,
java.util.Map<java.lang.String,java.lang.Object> options,
int socketId,
java.nio.ByteBuffer sib,
RecordLayer<Identifier> recordLayer)
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>
- Overrides:
read
in class SocketWrapperSocket<Identifier,Identifier>
- Returns:
-
- Throws:
java.io.IOException
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>
- Overrides:
write
in class SocketWrapperSocket<Identifier,Identifier>
- Throws:
java.io.IOException
close
public void close()
- Description copied from interface:
P2PSocket
- Closes this socket.
- Specified by:
close
in interface P2PSocket<Identifier>
- Overrides:
close
in class SocketWrapperSocket<Identifier,Identifier>
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>
- Overrides:
shutdownOutput
in class SocketWrapperSocket<Identifier,Identifier>
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>
- Overrides:
register
in class SocketWrapperSocket<Identifier,Identifier>
- Parameters:
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 control
Copyright © 2001-2005 - Rice Pastry.