|Constructor and Description|
|Modifier and Type||Method and Description|
Request the recv side to be closed.
Notify the lower layer that it should close.
Tracks if this layer is submitting data to be sent via
Callback to indicate the
Starts this layer.
SPI: Perform the actual write to the recipient.
acquire, doSend, getIoHub, init, isRecvOpen, newByteBufferQueue, onRead, onRecvClosed, release, stack
public void ready(boolean accept, boolean connect, boolean read, boolean write)
SelectableChannelthat this listener was registered for is ready for the indicated operations. The
SelectionKey.interestOps()will have been cleared for all the operations that are
trueso the callback can be assured that processing of any one specific operation will be linearized, though there may be concurrent calls to ready() with disjoint ready operations. The callback will most likely want to re-register for
IOHub.addInterestAccept(SelectionKey)immediately before returning from a ready notification of the read or accept status. The callback will only want to re-register for a
IOHub.addInterestWrite(SelectionKey)if it has filled the
SelectableChannel's output buffer and has more data to write.
accept- if the
SelectableChannelhas a connection to accept. Call
IOHub.addInterestAccept(SelectionKey)to request additional callbacks for this ready state.
connect- if the
SelectableChannelhas established a connection. Call
IOHub.addInterestConnect(SelectionKey)to request additional callbacks for this ready state.
read- if the
SelectableChannelhas data available to read. Call
IOHub.addInterestRead(SelectionKey)to request additional callbacks for this ready state.
write- if the
SelectableChannelcan accept data for writing. Call
IOHub.addInterestWrite(SelectionKey)to request additional callbacks for this ready state.
protected void write(@Nonnull ByteBuffer data) throws IOException
data- the data received. Any data consumed from the
ByteBuffercan be assumed as processed. Any data not consumed from the
ByteBufferwill be the responsibility of the caller to resubmit in subsequent calls.
IOException- if something goes wrong
public void doCloseRecv()
public void start() throws IOException
public void doCloseSend()
ProtocolLayer.Recv.onRecvClosed(IOException)for any upper layers.
public boolean isSendOpen()
ProtocolLayer.Send.doSend(ByteBuffer). Once this method returns
falseit must always return
falseand can be assumed to behave in this way.
Copyright © 2004–2021. All rights reserved.