Class AbstractChannel.AbstractUnsafe
java.lang.Object
io.netty.channel.AbstractChannel.AbstractUnsafe
- All Implemented Interfaces:
Channel.Unsafe
- Direct Known Subclasses:
AbstractNioChannel.AbstractNioUnsafe
- Enclosing class:
AbstractChannel
Channel.Unsafe implementation which sub-classes must extend and use.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final ThrowableannotateConnectException(Throwable cause, SocketAddress remoteAddress) Appends the remote address to the message of the exceptions caused by connection attempt failure.final voidSchedules a read operation that fills the inbound buffer of the firstChannelInboundHandlerin theChannelPipeline.final voidbind(SocketAddress localAddress, ChannelPromise promise) voidclose(ChannelPromise promise) Close theChannelof theChannelPromiseand notify theChannelPromiseonce the operation was complete.protected voidclose(ChannelPromise promise, Throwable cause, ClosedChannelException closeCause) final voidCloses theChannelimmediately without firing any events.protected final voidfinal voidderegister(ChannelPromise promise) Deregister theChannelof theChannelPromisefromEventLoopand notify theChannelPromiseonce the operation was complete.final voiddisconnect(ChannelPromise promise) Disconnect theChannelof theChannelFutureand notify theChannelPromiseonce the operation was complete.protected final booleanensureOpen(ChannelPromise promise) final voidflush()Flush out all write operations scheduled viaChannel.Unsafe.write(Object, ChannelPromise).protected voidflush0()protected final voidfinal SocketAddressReturn theSocketAddressto which is bound local ornullif none.final ChannelOutboundBufferReturns theChannelOutboundBufferof theChannelwhere the pending write requests are stored.protected ExecutorPrepares to close theChannel.Return the assignedRecvByteBufAllocator.Handlewhich will be used to allocateByteBuf's when receiving data.final voidregister(EventLoop eventLoop, ChannelPromise promise) Register theChannelof theChannelPromiseand notify theChannelFutureonce the registration was complete.final SocketAddressReturn theSocketAddressto which is bound remote ornullif none is bound yet.protected final voidsafeSetFailure(ChannelPromise promise, Throwable cause) Marks the specifiedpromiseas failure.protected final voidsafeSetSuccess(ChannelPromise promise) Marks the specifiedpromiseas success.final voidshutdownOutput(ChannelPromise promise) Shutdown the output portion of the correspondingChannel.final ChannelPromiseReturn a special ChannelPromise which can be reused and passed to the operations inChannel.Unsafe.final voidwrite(Object msg, ChannelPromise promise) Schedules a write operation.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Channel.Unsafe
connect
-
Constructor Details
-
AbstractUnsafe
protected AbstractUnsafe()
-
-
Method Details
-
recvBufAllocHandle
Description copied from interface:Channel.UnsafeReturn the assignedRecvByteBufAllocator.Handlewhich will be used to allocateByteBuf's when receiving data.- Specified by:
recvBufAllocHandlein interfaceChannel.Unsafe
-
outboundBuffer
Description copied from interface:Channel.UnsafeReturns theChannelOutboundBufferof theChannelwhere the pending write requests are stored.- Specified by:
outboundBufferin interfaceChannel.Unsafe
-
localAddress
Description copied from interface:Channel.UnsafeReturn theSocketAddressto which is bound local ornullif none.- Specified by:
localAddressin interfaceChannel.Unsafe
-
remoteAddress
Description copied from interface:Channel.UnsafeReturn theSocketAddressto which is bound remote ornullif none is bound yet.- Specified by:
remoteAddressin interfaceChannel.Unsafe
-
register
Description copied from interface:Channel.UnsafeRegister theChannelof theChannelPromiseand notify theChannelFutureonce the registration was complete.- Specified by:
registerin interfaceChannel.Unsafe
-
bind
Description copied from interface:Channel.Unsafe- Specified by:
bindin interfaceChannel.Unsafe
-
disconnect
Description copied from interface:Channel.UnsafeDisconnect theChannelof theChannelFutureand notify theChannelPromiseonce the operation was complete.- Specified by:
disconnectin interfaceChannel.Unsafe
-
close
Description copied from interface:Channel.UnsafeClose theChannelof theChannelPromiseand notify theChannelPromiseonce the operation was complete.- Specified by:
closein interfaceChannel.Unsafe
-
shutdownOutput
Shutdown the output portion of the correspondingChannel. For example this will clean up theChannelOutboundBufferand not allow any more writes. -
close
-
closeForcibly
public final void closeForcibly()Description copied from interface:Channel.UnsafeCloses theChannelimmediately without firing any events. Probably only useful when registration attempt failed.- Specified by:
closeForciblyin interfaceChannel.Unsafe
-
deregister
Description copied from interface:Channel.UnsafeDeregister theChannelof theChannelPromisefromEventLoopand notify theChannelPromiseonce the operation was complete.- Specified by:
deregisterin interfaceChannel.Unsafe
-
beginRead
public final void beginRead()Description copied from interface:Channel.UnsafeSchedules a read operation that fills the inbound buffer of the firstChannelInboundHandlerin theChannelPipeline. If there's already a pending read operation, this method does nothing.- Specified by:
beginReadin interfaceChannel.Unsafe
-
write
Description copied from interface:Channel.UnsafeSchedules a write operation.- Specified by:
writein interfaceChannel.Unsafe
-
flush
public final void flush()Description copied from interface:Channel.UnsafeFlush out all write operations scheduled viaChannel.Unsafe.write(Object, ChannelPromise).- Specified by:
flushin interfaceChannel.Unsafe
-
flush0
protected void flush0() -
handleWriteError
-
voidPromise
Description copied from interface:Channel.UnsafeReturn a special ChannelPromise which can be reused and passed to the operations inChannel.Unsafe. It will never be notified of a success or error and so is only a placeholder for operations that take aChannelPromiseas argument but for which you not want to get notified.- Specified by:
voidPromisein interfaceChannel.Unsafe
-
ensureOpen
-
safeSetSuccess
Marks the specifiedpromiseas success. If thepromiseis done already, log a message. -
safeSetFailure
Marks the specifiedpromiseas failure. If thepromiseis done already, log a message. -
closeIfClosed
protected final void closeIfClosed() -
annotateConnectException
Appends the remote address to the message of the exceptions caused by connection attempt failure. -
prepareToClose
Prepares to close theChannel. If this method returns anExecutor, the caller must call theExecutor.execute(Runnable)method with a task that callsAbstractChannel.doClose()on the returnedExecutor. If this method returnsnull,AbstractChannel.doClose()must be called from the caller thread. (i.e.EventLoop)
-