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,NioServerSocketChannel
public abstract class AbstractNioMessageChannel extends AbstractNioChannel
AbstractNioChannelbase class forChannels that operate on messages.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classAbstractNioMessageChannel.NioMessageUnsafe-
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 Modifier and Type Field Description (package private) booleaninputShutdown-
Fields inherited from class io.netty.channel.nio.AbstractNioChannel
readInterestOp, readPending, selectionKey
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractNioMessageChannel(Channel parent, java.nio.channels.SelectableChannel ch, int readInterestOp)
-
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 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
clearReadPending, doClose, doConnect, doDeregister, doFinishConnect, doRegister, eventLoop, isCompatible, isOpen, isReadPending, javaChannel, newDirectBuffer, newDirectBuffer, selectionKey, setReadPending, unsafe
-
Methods inherited from class io.netty.channel.AbstractChannel
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doBind, doDisconnect, doShutdownOutput, equals, filterOutboundMessage, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, localAddress, localAddress0, newChannelPipeline, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, parent, pipeline, read, remoteAddress, remoteAddress0, toString, validateFileRegion, voidPromise, write, write, writeAndFlush, writeAndFlush
-
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
-
-
-
-
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
-
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
-
-