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
AbstractNioChannelbase class forChannels 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 protectedAbstractNioMessageChannel(Channel parent, java.nio.channels.SelectableChannel ch, int readInterestOp)protectedAbstractNioMessageChannel(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 booleancloseOnReadError(java.lang.Throwable cause)protected booleancontinueOnWriteError()Returnstrueif we should continue the write loop on a write error.protected booleancontinueReading(RecvByteBufAllocator.Handle allocHandle)protected voiddoBeginRead()Schedule a read operation.protected abstract intdoReadMessages(java.util.List<java.lang.Object> buf)Read messages into the given array and return the amount which was read.protected voiddoWrite(ChannelOutboundBuffer in)Flush the content of the given buffer to the remote peer.protected abstract booleandoWriteMessage(java.lang.Object msg, ChannelOutboundBuffer in)Write a message to the underlyingChannel.protected AbstractNioChannel.AbstractNioUnsafenewUnsafe()Create a newAbstractChannel.AbstractUnsafeinstance 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:AbstractChannelCreate a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannel- Specified by:
newUnsafein classAbstractChannel
-
doBeginRead
protected void doBeginRead() throws java.lang.ExceptionDescription copied from class:AbstractChannelSchedule a read operation.- Overrides:
doBeginReadin 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:AbstractChannelFlush the content of the given buffer to the remote peer.- Specified by:
doWritein classAbstractChannel- Throws:
java.lang.Exception
-
continueOnWriteError
protected boolean continueOnWriteError()
Returnstrueif 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.ExceptionRead 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.ExceptionWrite a message to the underlyingChannel.- Returns:
trueif and only if the message has been written- Throws:
java.lang.Exception
-
-