Package io.netty.channel.nio
Class AbstractNioMessageChannel
- java.lang.Object
-
- io.netty.util.DefaultAttributeMap
-
- io.netty.channel.AbstractChannel
-
- io.netty.channel.nio.AbstractNioChannel
-
- io.netty.channel.nio.AbstractNioMessageChannel
-
- All Implemented Interfaces:
Channel
,ChannelOutboundInvoker
,AttributeMap
,java.lang.Comparable<Channel>
- Direct Known Subclasses:
NioDatagramChannel
,NioSctpChannel
,NioSctpServerChannel
,NioServerDomainSocketChannel
,NioServerSocketChannel
,NioUdtAcceptorChannel
,NioUdtMessageConnectorChannel
public abstract class AbstractNioMessageChannel extends AbstractNioChannel
AbstractNioChannel
base class forChannel
s that operate on messages.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.netty.channel.nio.AbstractNioChannel
AbstractNioChannel.AbstractNioUnsafe, AbstractNioChannel.NioUnsafe
-
Nested classes/interfaces inherited from class io.netty.channel.AbstractChannel
AbstractChannel.AbstractUnsafe
-
Nested classes/interfaces inherited from interface io.netty.channel.Channel
Channel.Unsafe
-
-
Field Summary
-
Fields inherited from class io.netty.channel.nio.AbstractNioChannel
readInterestOp, readOps
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractNioMessageChannel(Channel parent, java.nio.channels.SelectableChannel ch, int readInterestOp)
protected
AbstractNioMessageChannel(Channel parent, java.nio.channels.SelectableChannel ch, NioIoOps readOps)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
closeOnReadError(java.lang.Throwable cause)
protected boolean
continueOnWriteError()
Returnstrue
if we should continue the write loop on a write error.protected boolean
continueReading(RecvByteBufAllocator.Handle allocHandle)
protected void
doBeginRead()
Schedule a read operation.protected abstract int
doReadMessages(java.util.List<java.lang.Object> buf)
Read messages into the given array and return the amount which was read.protected void
doWrite(ChannelOutboundBuffer in)
Flush the content of the given buffer to the remote peer.protected abstract boolean
doWriteMessage(java.lang.Object msg, ChannelOutboundBuffer in)
Write a message to the underlyingChannel
.protected AbstractNioChannel.AbstractNioUnsafe
newUnsafe()
Create a newAbstractChannel.AbstractUnsafe
instance which will be used for the life-time of theChannel
-
Methods inherited from class io.netty.channel.nio.AbstractNioChannel
addAndSubmit, clearReadPending, doClose, doConnect, doDeregister, doFinishConnect, doRegister, isCompatible, isOpen, isReadPending, javaChannel, newDirectBuffer, newDirectBuffer, registration, removeAndSubmit, selectionKey, setReadPending, unsafe
-
Methods inherited from class io.netty.channel.AbstractChannel
closeFuture, compareTo, doBind, doDisconnect, doRegister, doShutdownOutput, equals, eventLoop, filterOutboundMessage, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, localAddress, localAddress0, maxMessagesPerWrite, newChannelPipeline, newId, parent, pipeline, remoteAddress, remoteAddress0, toString, validateFileRegion, voidPromise
-
Methods inherited from class io.netty.util.DefaultAttributeMap
attr, hasAttr
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty.util.AttributeMap
attr, hasAttr
-
Methods inherited from interface io.netty.channel.Channel
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, config, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, flush, getOption, isActive, isWritable, metadata, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, read, setOption, write, write, writeAndFlush, writeAndFlush
-
-
-
-
Constructor Detail
-
AbstractNioMessageChannel
protected AbstractNioMessageChannel(Channel parent, java.nio.channels.SelectableChannel ch, int readInterestOp)
-
-
Method Detail
-
newUnsafe
protected AbstractNioChannel.AbstractNioUnsafe newUnsafe()
Description copied from class:AbstractChannel
Create a newAbstractChannel.AbstractUnsafe
instance which will be used for the life-time of theChannel
- Specified by:
newUnsafe
in classAbstractChannel
-
doBeginRead
protected void doBeginRead() throws java.lang.Exception
Description copied from class:AbstractChannel
Schedule a read operation.- Overrides:
doBeginRead
in classAbstractNioChannel
- Throws:
java.lang.Exception
-
continueReading
protected boolean continueReading(RecvByteBufAllocator.Handle allocHandle)
-
doWrite
protected void doWrite(ChannelOutboundBuffer in) throws java.lang.Exception
Description copied from class:AbstractChannel
Flush the content of the given buffer to the remote peer.- Specified by:
doWrite
in classAbstractChannel
- Throws:
java.lang.Exception
-
continueOnWriteError
protected boolean continueOnWriteError()
Returnstrue
if we should continue the write loop on a write error.
-
closeOnReadError
protected boolean closeOnReadError(java.lang.Throwable cause)
-
doReadMessages
protected abstract int doReadMessages(java.util.List<java.lang.Object> buf) throws java.lang.Exception
Read messages into the given array and return the amount which was read.- Throws:
java.lang.Exception
-
doWriteMessage
protected abstract boolean doWriteMessage(java.lang.Object msg, ChannelOutboundBuffer in) throws java.lang.Exception
Write a message to the underlyingChannel
.- Returns:
true
if and only if the message has been written- Throws:
java.lang.Exception
-
-