Rice Pastry API

org.mpisws.p2p.transport.peerreview.replay.record
Class RecordSocket<Identifier>

java.lang.Object
  extended by org.mpisws.p2p.transport.util.SocketWrapperSocket<Identifier,Identifier>
      extended by org.mpisws.p2p.transport.peerreview.replay.record.RecordSocket<Identifier>
All Implemented Interfaces:
P2PSocket<Identifier>, P2PSocketReceiver<Identifier>, PeerReviewConstants, StatusConstants

public class RecordSocket<Identifier>
extends SocketWrapperSocket<Identifier,Identifier>
implements PeerReviewConstants


Field Summary
 
Fields inherited from class org.mpisws.p2p.transport.util.SocketWrapperSocket
errorHandler, identifier, logger, options, reader, socket, writer
 
Fields inherited from interface org.mpisws.p2p.transport.peerreview.PeerReviewConstants
AUTH_CACHE_INTERVAL, CERT_MISSING, CHAL_AUDIT, CHAL_SEND, DEFAULT_AUDIT_INTERVAL_MILLIS, DEFAULT_AUTH_PUSH_INTERVAL_MILLIS, DEFAULT_CHECKPOINT_INTERVAL_MILLIS, DEFAULT_LOG_DOWNLOAD_TIMEOUT, DEFAULT_TIME_TOLERANCE_MILLIS, EVT_ACK, EVT_CHECKPOINT, EVT_CHOOSE_Q, EVT_CHOOSE_RAND, EVT_INIT, EVT_MAX_RESERVED, 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, EVT_VRF, EX_TYPE_ClosedChannel, EX_TYPE_IO, EX_TYPE_Unknown, FLAG_FULL_MESSAGES_ALL, FLAG_FULL_MESSAGES_SENDER, FLAG_INCLUDE_CHECKPOINT, INVALID, INVESTIGATION_INTERVAL_MILLIS, MAINTENANCE_INTERVAL_MILLIS, MAX_ACTIVE_AUDITS, MAX_ACTIVE_INVESTIGATIONS, MAX_ENTRIES_BETWEEN_CHECKPOINTS, MAX_STATUS_INFO, MAX_WITNESSED_NODES, MSG_ACCUSATION, MSG_ACK, MSG_AUTHPUSH, MSG_AUTHREQ, MSG_AUTHRESP, MSG_CHALLENGE, MSG_RESPONSE, MSG_USERDATA, MSG_USERDGRAM, NO_CERTIFICATE, PROGRESS_INTERVAL_MILLIS, PROOF_INCONSISTENT, PROOF_NONCONFORMANT, RESP_AUDIT, RESP_SEND, SIGNATURE_BAD, SIGNATURE_OK, STATE_SEND_AUDIT, STATE_WAIT_FOR_LOG, TI_AUTH_PUSH, TI_CHECKPOINT, TI_MAINTENANCE, TI_MAKE_PROGRESS, TI_MAX_RESERVED, TI_START_AUDITS, TI_STATUS_INFO, VALID
 
Fields inherited from interface org.mpisws.p2p.transport.peerreview.StatusConstants
STATUS_EXPOSED, STATUS_SUSPECTED, STATUS_TRUSTED
 
Constructor Summary
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)
           
 
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 org.mpisws.p2p.transport.util.SocketWrapperSocket
getIdentifier, getOptions, receiveException, receiveSelectResult, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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)
Method Detail

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 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

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection