Package org.elasticsearch.nio
Class BytesChannelContext
- java.lang.Object
-
- org.elasticsearch.nio.ChannelContext<java.nio.channels.SocketChannel>
-
- org.elasticsearch.nio.SocketChannelContext
-
- org.elasticsearch.nio.BytesChannelContext
-
public class BytesChannelContext extends SocketChannelContext
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.nio.SocketChannelContext
channel, channelBuffer, isClosing
-
Fields inherited from class org.elasticsearch.nio.ChannelContext
rawChannel
-
-
Constructor Summary
Constructors Constructor Description BytesChannelContext(NioSocketChannel channel, NioSelector selector, java.util.function.Consumer<java.lang.Exception> exceptionHandler, NioChannelHandler handler, InboundChannelBuffer channelBuffer)
-
Method Summary
Modifier and Type Method Description voidcloseChannel()Schedules a channel to be closed by the selector event loop with which it is registered.voidflushChannel()intread()booleanselectorShouldClose()This method indicates if a selector should close this channel.-
Methods inherited from class org.elasticsearch.nio.SocketChannelContext
addConnectListener, closeFromSelector, closeNow, connect, currentFlushOperationComplete, currentFlushOperationFailed, flushToChannel, getChannel, getPendingFlush, getSelector, handleReadBytes, isConnectComplete, queueWriteOperation, readFromChannel, readyForFlush, register, sendMessage, setCloseNow
-
Methods inherited from class org.elasticsearch.nio.ChannelContext
addCloseListener, handleException, isOpen, setSelectionKey
-
-
-
-
Constructor Detail
-
BytesChannelContext
public BytesChannelContext(NioSocketChannel channel, NioSelector selector, java.util.function.Consumer<java.lang.Exception> exceptionHandler, NioChannelHandler handler, InboundChannelBuffer channelBuffer)
-
-
Method Detail
-
read
public int read() throws java.io.IOException- Specified by:
readin classSocketChannelContext- Throws:
java.io.IOException
-
flushChannel
public void flushChannel() throws java.io.IOException- Specified by:
flushChannelin classSocketChannelContext- Throws:
java.io.IOException
-
closeChannel
public void closeChannel()
Description copied from class:ChannelContextSchedules a channel to be closed by the selector event loop with which it is registered. If the channel is open and the state can be transitioned to closed, the close operation will be scheduled with the event loop. Depending on the underlying protocol of the channel, a close operation might simply close the socket channel or may involve reading and writing messages.- Specified by:
closeChannelin classChannelContext<java.nio.channels.SocketChannel>
-
selectorShouldClose
public boolean selectorShouldClose()
Description copied from class:SocketChannelContextThis method indicates if a selector should close this channel.- Specified by:
selectorShouldClosein classSocketChannelContext- Returns:
- a boolean indicating if the selector should close
-
-