Class AbstractChannel
- java.lang.Object
-
- io.netty.util.DefaultAttributeMap
-
- io.netty.channel.AbstractChannel
-
- All Implemented Interfaces:
Channel,ChannelOutboundInvoker,AttributeMap,java.lang.Comparable<Channel>
- Direct Known Subclasses:
AbstractNioChannel,AbstractOioChannel,AbstractServerChannel,EmbeddedChannel,FailedChannel,LocalChannel
public abstract class AbstractChannel extends DefaultAttributeMap implements Channel
A skeletalChannelimplementation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAbstractChannel.AbstractUnsafeChannel.Unsafeimplementation which sub-classes must extend and use.private static classAbstractChannel.AnnotatedConnectExceptionprivate static classAbstractChannel.AnnotatedNoRouteToHostExceptionprivate static classAbstractChannel.AnnotatedSocketException(package private) static classAbstractChannel.CloseFuture-
Nested classes/interfaces inherited from interface io.netty.channel.Channel
Channel.Unsafe
-
-
Field Summary
Fields Modifier and Type Field Description private AbstractChannel.CloseFuturecloseFutureprivate booleancloseInitiatedprivate EventLoopeventLoopprivate ChannelIdidprivate java.lang.ThrowableinitialCloseCauseprivate java.net.SocketAddresslocalAddressprivate static InternalLoggerloggerprivate Channelparentprivate DefaultChannelPipelinepipelineprivate booleanregisteredprivate java.net.SocketAddressremoteAddressprivate java.lang.StringstrValprivate booleanstrValActiveCache for the string representation of this channelprivate Channel.Unsafeunsafeprivate VoidChannelPromiseunsafeVoidPromise
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractChannel(Channel parent)Creates a new instance.protectedAbstractChannel(Channel parent, ChannelId id)Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ByteBufAllocatoralloc()Return the assignedByteBufAllocatorwhich will be used to allocateByteBufs.ChannelFuturebind(java.net.SocketAddress localAddress)Request to bind to the givenSocketAddressand notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.ChannelFuturebind(java.net.SocketAddress localAddress, ChannelPromise promise)Request to bind to the givenSocketAddressand notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.longbytesBeforeUnwritable()Get how many bytes can be written untilChannel.isWritable()returnsfalse.longbytesBeforeWritable()Get how many bytes must be drained from underlying buffers untilChannel.isWritable()returnstrue.ChannelFutureclose()Request to close theChanneland notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.ChannelFutureclose(ChannelPromise promise)Request to close theChanneland notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.ChannelFuturecloseFuture()Returns theChannelFuturewhich will be notified when this channel is closed.intcompareTo(Channel o)ChannelFutureconnect(java.net.SocketAddress remoteAddress)Request to connect to the givenSocketAddressand notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.ChannelFutureconnect(java.net.SocketAddress remoteAddress, ChannelPromise promise)Request to connect to the givenSocketAddressand notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.ChannelFutureconnect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)Request to connect to the givenSocketAddresswhile bind to the localAddress and notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.ChannelFutureconnect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)Request to connect to the givenSocketAddresswhile bind to the localAddress and notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.ChannelFuturederegister()Request to deregister from the previous assignedEventExecutorand notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.ChannelFuturederegister(ChannelPromise promise)Request to deregister from the previous assignedEventExecutorand notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.ChannelFuturedisconnect()Request to disconnect from the remote peer and notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.ChannelFuturedisconnect(ChannelPromise promise)Request to disconnect from the remote peer and notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.protected abstract voiddoBeginRead()Schedule a read operation.protected abstract voiddoBind(java.net.SocketAddress localAddress)Bind theChannelto theSocketAddressprotected abstract voiddoClose()Close theChannelprotected voiddoDeregister()protected abstract voiddoDisconnect()Disconnect thisChannelfrom its remote peerprotected voiddoRegister()protected voiddoShutdownOutput()Called when conditions justify shutting down the output portion of the channel.protected abstract voiddoWrite(ChannelOutboundBuffer in)Flush the content of the given buffer to the remote peer.booleanequals(java.lang.Object o)Returnstrueif and only if the specified object is identical with this channel (i.e:this == o).EventLoopeventLoop()protected java.lang.ObjectfilterOutboundMessage(java.lang.Object msg)Invoked when a new message is added to aChannelOutboundBufferof thisAbstractChannel, so that theChannelimplementation converts the message to another.Channelflush()Request to flush all pending messages via this ChannelOutboundInvoker.inthashCode()Returns the ID of this channel.ChannelIdid()Returns the globally unique identifier of thisChannel.protected voidinvalidateLocalAddress()Deprecated.no use-case for this.protected voidinvalidateRemoteAddress()Deprecated.no use-case for this.protected abstract booleanisCompatible(EventLoop loop)Returntrueif the givenEventLoopis compatible with this instance.booleanisRegistered()booleanisWritable()Returnstrueif and only if the I/O thread will perform the requested write operation immediately.java.net.SocketAddresslocalAddress()Returns the local address where this channel is bound to.protected abstract java.net.SocketAddresslocalAddress0()Returns theSocketAddresswhich is bound locally.protected DefaultChannelPipelinenewChannelPipeline()Returns a newDefaultChannelPipelineinstance.ChannelFuturenewFailedFuture(java.lang.Throwable cause)Create a newChannelFuturewhich is marked as failed already.protected ChannelIdnewId()Returns a newDefaultChannelIdinstance.ChannelProgressivePromisenewProgressivePromise()Return an newChannelProgressivePromiseChannelPromisenewPromise()Return a newChannelPromise.ChannelFuturenewSucceededFuture()Create a newChannelFuturewhich is marked as succeeded already.protected abstract AbstractChannel.AbstractUnsafenewUnsafe()Create a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannelChannelparent()Returns the parent of this channel.ChannelPipelinepipeline()Return the assignedChannelPipeline.Channelread()Request to Read data from theChannelinto the first inbound buffer, triggers anChannelInboundHandler.channelRead(ChannelHandlerContext, Object)event if data was read, and triggers achannelReadCompleteevent so the handler can decide to continue reading.java.net.SocketAddressremoteAddress()Returns the remote address where this channel is connected to.protected abstract java.net.SocketAddressremoteAddress0()Return theSocketAddresswhich theChannelis connected to.java.lang.StringtoString()Returns theStringrepresentation of this channel.Channel.Unsafeunsafe()Returns an internal-use-only object that provides unsafe operations.protected voidvalidateFileRegion(DefaultFileRegion region, long position)ChannelPromisevoidPromise()Return a special ChannelPromise which can be reused for different operations.ChannelFuturewrite(java.lang.Object msg)Request to write a message via thisChannelHandlerContextthrough theChannelPipeline.ChannelFuturewrite(java.lang.Object msg, ChannelPromise promise)Request to write a message via thisChannelHandlerContextthrough theChannelPipeline.ChannelFuturewriteAndFlush(java.lang.Object msg)Shortcut for callChannelOutboundInvoker.write(Object)andChannelOutboundInvoker.flush().ChannelFuturewriteAndFlush(java.lang.Object msg, ChannelPromise promise)Shortcut for callChannelOutboundInvoker.write(Object, ChannelPromise)andChannelOutboundInvoker.flush().-
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
-
-
-
-
Field Detail
-
logger
private static final InternalLogger logger
-
parent
private final Channel parent
-
id
private final ChannelId id
-
unsafe
private final Channel.Unsafe unsafe
-
pipeline
private final DefaultChannelPipeline pipeline
-
unsafeVoidPromise
private final VoidChannelPromise unsafeVoidPromise
-
closeFuture
private final AbstractChannel.CloseFuture closeFuture
-
localAddress
private volatile java.net.SocketAddress localAddress
-
remoteAddress
private volatile java.net.SocketAddress remoteAddress
-
eventLoop
private volatile EventLoop eventLoop
-
registered
private volatile boolean registered
-
closeInitiated
private boolean closeInitiated
-
initialCloseCause
private java.lang.Throwable initialCloseCause
-
strValActive
private boolean strValActive
Cache for the string representation of this channel
-
strVal
private java.lang.String strVal
-
-
Constructor Detail
-
AbstractChannel
protected AbstractChannel(Channel parent)
Creates a new instance.- Parameters:
parent- the parent of this channel.nullif there's no parent.
-
-
Method Detail
-
id
public final ChannelId id()
Description copied from interface:ChannelReturns the globally unique identifier of thisChannel.
-
newId
protected ChannelId newId()
Returns a newDefaultChannelIdinstance. Subclasses may override this method to assign customChannelIds toChannels that use theAbstractChannel(Channel)constructor.
-
newChannelPipeline
protected DefaultChannelPipeline newChannelPipeline()
Returns a newDefaultChannelPipelineinstance.
-
isWritable
public boolean isWritable()
Description copied from interface:ChannelReturnstrueif and only if the I/O thread will perform the requested write operation immediately. Any write requests made when this method returnsfalseare queued until the I/O thread is ready to process the queued write requests.- Specified by:
isWritablein interfaceChannel
-
bytesBeforeUnwritable
public long bytesBeforeUnwritable()
Description copied from interface:ChannelGet how many bytes can be written untilChannel.isWritable()returnsfalse. This quantity will always be non-negative. IfChannel.isWritable()isfalsethen 0.- Specified by:
bytesBeforeUnwritablein interfaceChannel
-
bytesBeforeWritable
public long bytesBeforeWritable()
Description copied from interface:ChannelGet how many bytes must be drained from underlying buffers untilChannel.isWritable()returnstrue. This quantity will always be non-negative. IfChannel.isWritable()istruethen 0.- Specified by:
bytesBeforeWritablein interfaceChannel
-
parent
public Channel parent()
Description copied from interface:ChannelReturns the parent of this channel.
-
pipeline
public ChannelPipeline pipeline()
Description copied from interface:ChannelReturn the assignedChannelPipeline.
-
alloc
public ByteBufAllocator alloc()
Description copied from interface:ChannelReturn the assignedByteBufAllocatorwhich will be used to allocateByteBufs.
-
localAddress
public java.net.SocketAddress localAddress()
Description copied from interface:ChannelReturns the local address where this channel is bound to. The returnedSocketAddressis supposed to be down-cast into more concrete type such asInetSocketAddressto retrieve the detailed information.- Specified by:
localAddressin interfaceChannel- Returns:
- the local address of this channel.
nullif this channel is not bound.
-
invalidateLocalAddress
@Deprecated protected void invalidateLocalAddress()
Deprecated.no use-case for this.
-
remoteAddress
public java.net.SocketAddress remoteAddress()
Description copied from interface:ChannelReturns the remote address where this channel is connected to. The returnedSocketAddressis supposed to be down-cast into more concrete type such asInetSocketAddressto retrieve the detailed information.- Specified by:
remoteAddressin interfaceChannel- Returns:
- the remote address of this channel.
nullif this channel is not connected. If this channel is not connected but it can receive messages from arbitrary remote addresses (e.g.DatagramChannel, useDefaultAddressedEnvelope.recipient()to determine the origination of the received message as this method will returnnull.
-
invalidateRemoteAddress
@Deprecated protected void invalidateRemoteAddress()
Deprecated.no use-case for this.
-
isRegistered
public boolean isRegistered()
Description copied from interface:Channel- Specified by:
isRegisteredin interfaceChannel
-
bind
public ChannelFuture bind(java.net.SocketAddress localAddress)
Description copied from interface:ChannelOutboundInvokerRequest to bind to the givenSocketAddressand notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelOutboundHandler.bind(ChannelHandlerContext, SocketAddress, ChannelPromise)method called of the nextChannelOutboundHandlercontained in theChannelPipelineof theChannel.- Specified by:
bindin interfaceChannelOutboundInvoker
-
connect
public ChannelFuture connect(java.net.SocketAddress remoteAddress)
Description copied from interface:ChannelOutboundInvokerRequest to connect to the givenSocketAddressand notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.If the connection fails because of a connection timeout, the
ChannelFuturewill get failed with aConnectTimeoutException. If it fails because of connection refused aConnectExceptionwill be used.This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)method called of the nextChannelOutboundHandlercontained in theChannelPipelineof theChannel.- Specified by:
connectin interfaceChannelOutboundInvoker
-
connect
public ChannelFuture connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)
Description copied from interface:ChannelOutboundInvokerRequest to connect to the givenSocketAddresswhile bind to the localAddress and notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)method called of the nextChannelOutboundHandlercontained in theChannelPipelineof theChannel.- Specified by:
connectin interfaceChannelOutboundInvoker
-
disconnect
public ChannelFuture disconnect()
Description copied from interface:ChannelOutboundInvokerRequest to disconnect from the remote peer and notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelOutboundHandler.disconnect(ChannelHandlerContext, ChannelPromise)method called of the nextChannelOutboundHandlercontained in theChannelPipelineof theChannel.- Specified by:
disconnectin interfaceChannelOutboundInvoker
-
close
public ChannelFuture close()
Description copied from interface:ChannelOutboundInvokerRequest to close theChanneland notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error. After it is closed it is not possible to reuse it again.This will result in having the
ChannelOutboundHandler.close(ChannelHandlerContext, ChannelPromise)method called of the nextChannelOutboundHandlercontained in theChannelPipelineof theChannel.- Specified by:
closein interfaceChannelOutboundInvoker
-
deregister
public ChannelFuture deregister()
Description copied from interface:ChannelOutboundInvokerRequest to deregister from the previous assignedEventExecutorand notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error.This will result in having the
ChannelOutboundHandler.deregister(ChannelHandlerContext, ChannelPromise)method called of the nextChannelOutboundHandlercontained in theChannelPipelineof theChannel.- Specified by:
deregisterin interfaceChannelOutboundInvoker
-
flush
public Channel flush()
Description copied from interface:ChannelOutboundInvokerRequest to flush all pending messages via this ChannelOutboundInvoker.- Specified by:
flushin interfaceChannel- Specified by:
flushin interfaceChannelOutboundInvoker
-
bind
public ChannelFuture bind(java.net.SocketAddress localAddress, ChannelPromise promise)
Description copied from interface:ChannelOutboundInvokerRequest to bind to the givenSocketAddressand notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error. The givenChannelPromisewill be notified.This will result in having the
ChannelOutboundHandler.bind(ChannelHandlerContext, SocketAddress, ChannelPromise)method called of the nextChannelOutboundHandlercontained in theChannelPipelineof theChannel.- Specified by:
bindin interfaceChannelOutboundInvoker
-
connect
public ChannelFuture connect(java.net.SocketAddress remoteAddress, ChannelPromise promise)
Description copied from interface:ChannelOutboundInvokerRequest to connect to the givenSocketAddressand notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error. The givenChannelFuturewill be notified.If the connection fails because of a connection timeout, the
ChannelFuturewill get failed with aConnectTimeoutException. If it fails because of connection refused aConnectExceptionwill be used.This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)method called of the nextChannelOutboundHandlercontained in theChannelPipelineof theChannel.- Specified by:
connectin interfaceChannelOutboundInvoker
-
connect
public ChannelFuture connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)
Description copied from interface:ChannelOutboundInvokerRequest to connect to the givenSocketAddresswhile bind to the localAddress and notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error. The givenChannelPromisewill be notified and also returned.This will result in having the
ChannelOutboundHandler.connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)method called of the nextChannelOutboundHandlercontained in theChannelPipelineof theChannel.- Specified by:
connectin interfaceChannelOutboundInvoker
-
disconnect
public ChannelFuture disconnect(ChannelPromise promise)
Description copied from interface:ChannelOutboundInvokerRequest to disconnect from the remote peer and notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error. The givenChannelPromisewill be notified.This will result in having the
ChannelOutboundHandler.disconnect(ChannelHandlerContext, ChannelPromise)method called of the nextChannelOutboundHandlercontained in theChannelPipelineof theChannel.- Specified by:
disconnectin interfaceChannelOutboundInvoker
-
close
public ChannelFuture close(ChannelPromise promise)
Description copied from interface:ChannelOutboundInvokerRequest to close theChanneland notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error. After it is closed it is not possible to reuse it again. The givenChannelPromisewill be notified.This will result in having the
ChannelOutboundHandler.close(ChannelHandlerContext, ChannelPromise)method called of the nextChannelOutboundHandlercontained in theChannelPipelineof theChannel.- Specified by:
closein interfaceChannelOutboundInvoker
-
deregister
public ChannelFuture deregister(ChannelPromise promise)
Description copied from interface:ChannelOutboundInvokerRequest to deregister from the previous assignedEventExecutorand notify theChannelFutureonce the operation completes, either because the operation was successful or because of an error. The givenChannelPromisewill be notified.This will result in having the
ChannelOutboundHandler.deregister(ChannelHandlerContext, ChannelPromise)method called of the nextChannelOutboundHandlercontained in theChannelPipelineof theChannel.- Specified by:
deregisterin interfaceChannelOutboundInvoker
-
read
public Channel read()
Description copied from interface:ChannelOutboundInvokerRequest to Read data from theChannelinto the first inbound buffer, triggers anChannelInboundHandler.channelRead(ChannelHandlerContext, Object)event if data was read, and triggers achannelReadCompleteevent so the handler can decide to continue reading. If there's a pending read operation already, this method does nothing.This will result in having the
ChannelOutboundHandler.read(ChannelHandlerContext)method called of the nextChannelOutboundHandlercontained in theChannelPipelineof theChannel.- Specified by:
readin interfaceChannel- Specified by:
readin interfaceChannelOutboundInvoker
-
write
public ChannelFuture write(java.lang.Object msg)
Description copied from interface:ChannelOutboundInvokerRequest to write a message via thisChannelHandlerContextthrough theChannelPipeline. This method will not request to actual flush, so be sure to callChannelOutboundInvoker.flush()once you want to request to flush all pending data to the actual transport.- Specified by:
writein interfaceChannelOutboundInvoker
-
write
public ChannelFuture write(java.lang.Object msg, ChannelPromise promise)
Description copied from interface:ChannelOutboundInvokerRequest to write a message via thisChannelHandlerContextthrough theChannelPipeline. This method will not request to actual flush, so be sure to callChannelOutboundInvoker.flush()once you want to request to flush all pending data to the actual transport.- Specified by:
writein interfaceChannelOutboundInvoker
-
writeAndFlush
public ChannelFuture writeAndFlush(java.lang.Object msg)
Description copied from interface:ChannelOutboundInvokerShortcut for callChannelOutboundInvoker.write(Object)andChannelOutboundInvoker.flush().- Specified by:
writeAndFlushin interfaceChannelOutboundInvoker
-
writeAndFlush
public ChannelFuture writeAndFlush(java.lang.Object msg, ChannelPromise promise)
Description copied from interface:ChannelOutboundInvokerShortcut for callChannelOutboundInvoker.write(Object, ChannelPromise)andChannelOutboundInvoker.flush().- Specified by:
writeAndFlushin interfaceChannelOutboundInvoker
-
newPromise
public ChannelPromise newPromise()
Description copied from interface:ChannelOutboundInvokerReturn a newChannelPromise.- Specified by:
newPromisein interfaceChannelOutboundInvoker
-
newProgressivePromise
public ChannelProgressivePromise newProgressivePromise()
Description copied from interface:ChannelOutboundInvokerReturn an newChannelProgressivePromise- Specified by:
newProgressivePromisein interfaceChannelOutboundInvoker
-
newSucceededFuture
public ChannelFuture newSucceededFuture()
Description copied from interface:ChannelOutboundInvokerCreate a newChannelFuturewhich is marked as succeeded already. SoFuture.isSuccess()will returntrue. AllFutureListeneradded to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newSucceededFuturein interfaceChannelOutboundInvoker
-
newFailedFuture
public ChannelFuture newFailedFuture(java.lang.Throwable cause)
Description copied from interface:ChannelOutboundInvokerCreate a newChannelFuturewhich is marked as failed already. SoFuture.isSuccess()will returnfalse. AllFutureListeneradded to it will be notified directly. Also every call of blocking methods will just return without blocking.- Specified by:
newFailedFuturein interfaceChannelOutboundInvoker
-
closeFuture
public ChannelFuture closeFuture()
Description copied from interface:ChannelReturns theChannelFuturewhich will be notified when this channel is closed. This method always returns the same future instance.- Specified by:
closeFuturein interfaceChannel
-
unsafe
public Channel.Unsafe unsafe()
Description copied from interface:ChannelReturns an internal-use-only object that provides unsafe operations.
-
newUnsafe
protected abstract AbstractChannel.AbstractUnsafe newUnsafe()
Create a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannel
-
hashCode
public final int hashCode()
Returns the ID of this channel.- Overrides:
hashCodein classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object o)
Returnstrueif and only if the specified object is identical with this channel (i.e:this == o).- Overrides:
equalsin classjava.lang.Object
-
compareTo
public final int compareTo(Channel o)
- Specified by:
compareToin interfacejava.lang.Comparable<Channel>
-
toString
public java.lang.String toString()
Returns theStringrepresentation of this channel. The returned string contains the ID, local address, and remote address of this channel for easier identification.- Overrides:
toStringin classjava.lang.Object
-
voidPromise
public final ChannelPromise voidPromise()
Description copied from interface:ChannelOutboundInvokerReturn a special ChannelPromise which can be reused for different operations.It's only supported to use it for
ChannelOutboundInvoker.write(Object, ChannelPromise).Be aware that the returned
Be aware this is an expert feature and should be used with care!ChannelPromisewill not support most operations and should only be used if you want to save an object allocation for every write operation. You will not be able to detect if the operation was complete, only if it failed as the implementation will callChannelPipeline.fireExceptionCaught(Throwable)in this case.- Specified by:
voidPromisein interfaceChannelOutboundInvoker
-
isCompatible
protected abstract boolean isCompatible(EventLoop loop)
Returntrueif the givenEventLoopis compatible with this instance.
-
localAddress0
protected abstract java.net.SocketAddress localAddress0()
Returns theSocketAddresswhich is bound locally.
-
remoteAddress0
protected abstract java.net.SocketAddress remoteAddress0()
Return theSocketAddresswhich theChannelis connected to.
-
doRegister
protected void doRegister() throws java.lang.ExceptionIs called after theChannelis registered with itsEventLoopas part of the register process. Sub-classes may override this method- Throws:
java.lang.Exception
-
doBind
protected abstract void doBind(java.net.SocketAddress localAddress) throws java.lang.ExceptionBind theChannelto theSocketAddress- Throws:
java.lang.Exception
-
doDisconnect
protected abstract void doDisconnect() throws java.lang.ExceptionDisconnect thisChannelfrom its remote peer- Throws:
java.lang.Exception
-
doClose
protected abstract void doClose() throws java.lang.ExceptionClose theChannel- Throws:
java.lang.Exception
-
doShutdownOutput
@UnstableApi protected void doShutdownOutput() throws java.lang.Exception
Called when conditions justify shutting down the output portion of the channel. This may happen if a write operation throws an exception.- Throws:
java.lang.Exception
-
doDeregister
protected void doDeregister() throws java.lang.Exception- Throws:
java.lang.Exception
-
doBeginRead
protected abstract void doBeginRead() throws java.lang.ExceptionSchedule a read operation.- Throws:
java.lang.Exception
-
doWrite
protected abstract void doWrite(ChannelOutboundBuffer in) throws java.lang.Exception
Flush the content of the given buffer to the remote peer.- Throws:
java.lang.Exception
-
filterOutboundMessage
protected java.lang.Object filterOutboundMessage(java.lang.Object msg) throws java.lang.ExceptionInvoked when a new message is added to aChannelOutboundBufferof thisAbstractChannel, so that theChannelimplementation converts the message to another. (e.g. heap buffer -> direct buffer)- Throws:
java.lang.Exception
-
validateFileRegion
protected void validateFileRegion(DefaultFileRegion region, long position) throws java.io.IOException
- Throws:
java.io.IOException
-
-