protected abstract class AbstractChannel.AbstractUnsafe extends Object implements Channel.Unsafe
Unsafe implementation which sub-classes must extend and use.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractChannel.AbstractUnsafe() |
| Modifier and Type | Method and Description |
|---|---|
protected Throwable |
annotateConnectException(Throwable cause,
SocketAddress remoteAddress)
Appends the remote address to the message of the exceptions caused by connection attempt failure.
|
void |
beginRead()
Schedules a read operation that fills the inbound buffer of the first
ChannelHandler in the
ChannelPipeline. |
void |
bind(SocketAddress localAddress,
ChannelPromise promise)
|
void |
close(ChannelPromise promise)
Close the
Channel of the ChannelPromise and notify the ChannelPromise once the
operation was complete. |
protected Executor |
closeExecutor() |
void |
closeForcibly()
Closes the
Channel immediately without firing any events. |
protected void |
closeIfClosed() |
void |
deregister(ChannelPromise promise)
This method must NEVER be called directly, but be executed as an
extra task with a clean call stack instead.
|
void |
disconnect(ChannelPromise promise)
Disconnect the
Channel of the ChannelFuture and notify the ChannelPromise once the
operation was complete. |
protected boolean |
ensureOpen(ChannelPromise promise) |
void |
flush()
Flush out all write operations scheduled via
Channel.Unsafe.write(Object, ChannelPromise). |
protected void |
flush0() |
ChannelHandlerInvoker |
invoker()
Returns the
ChannelHandlerInvoker which is used by default unless specified by a user. |
SocketAddress |
localAddress()
Return the
SocketAddress to which is bound local or
null if none. |
ChannelOutboundBuffer |
outboundBuffer()
Returns the
ChannelOutboundBuffer of the Channel where the pending write requests are stored. |
RecvByteBufAllocator.Handle |
recvBufAllocHandle()
Return the assigned
RecvByteBufAllocator.Handle which will be used to allocate ByteBuf's when
receiving data. |
void |
register(EventLoop eventLoop,
ChannelPromise promise)
Register the
Channel of the ChannelPromise and notify
the ChannelFuture once the registration was complete. |
SocketAddress |
remoteAddress()
Return the
SocketAddress to which is bound remote or
null if none is bound yet. |
protected void |
safeSetFailure(ChannelPromise promise,
Throwable cause)
Marks the specified
promise as failure. |
protected void |
safeSetSuccess(ChannelPromise promise)
Marks the specified
promise as success. |
ChannelPromise |
voidPromise()
Return a special ChannelPromise which can be reused and passed to the operations in
Channel.Unsafe. |
void |
write(Object msg,
ChannelPromise promise)
Schedules a write operation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconnectpublic RecvByteBufAllocator.Handle recvBufAllocHandle()
Channel.UnsafeRecvByteBufAllocator.Handle which will be used to allocate ByteBuf's when
receiving data.recvBufAllocHandle in interface Channel.Unsafepublic final ChannelHandlerInvoker invoker()
Channel.UnsafeChannelHandlerInvoker which is used by default unless specified by a user.invoker in interface Channel.Unsafepublic final ChannelOutboundBuffer outboundBuffer()
Channel.UnsafeChannelOutboundBuffer of the Channel where the pending write requests are stored.outboundBuffer in interface Channel.Unsafepublic final SocketAddress localAddress()
Channel.UnsafeSocketAddress to which is bound local or
null if none.localAddress in interface Channel.Unsafepublic final SocketAddress remoteAddress()
Channel.UnsafeSocketAddress to which is bound remote or
null if none is bound yet.remoteAddress in interface Channel.Unsafepublic final void register(EventLoop eventLoop, ChannelPromise promise)
Channel.UnsafeChannel of the ChannelPromise and notify
the ChannelFuture once the registration was complete.
It's only safe to submit a new task to the EventLoop from within a
ChannelHandler once the ChannelPromise succeeded. Otherwise
the task may or may not be rejected.
register in interface Channel.Unsafepublic final void bind(SocketAddress localAddress, ChannelPromise promise)
Channel.Unsafebind in interface Channel.Unsafepublic final void disconnect(ChannelPromise promise)
Channel.UnsafeChannel of the ChannelFuture and notify the ChannelPromise once the
operation was complete.disconnect in interface Channel.Unsafepublic final void close(ChannelPromise promise)
Channel.UnsafeChannel of the ChannelPromise and notify the ChannelPromise once the
operation was complete.close in interface Channel.Unsafepublic final void closeForcibly()
Channel.UnsafeChannel immediately without firing any events. Probably only useful
when registration attempt failed.closeForcibly in interface Channel.Unsafepublic final void deregister(ChannelPromise promise)
ChannelPipeline.fireChannelUnregistered()
directly, which might lead to an unfortunate nesting of independent inbound/outbound
events. See the comments in invokeLater(Runnable) for more details.deregister in interface Channel.Unsafepublic final void beginRead()
Channel.UnsafeChannelHandler in the
ChannelPipeline. If there's already a pending read operation, this method does nothing.beginRead in interface Channel.Unsafepublic final void write(Object msg, ChannelPromise promise)
Channel.Unsafewrite in interface Channel.Unsafepublic final void flush()
Channel.UnsafeChannel.Unsafe.write(Object, ChannelPromise).flush in interface Channel.Unsafeprotected void flush0()
public final ChannelPromise voidPromise()
Channel.UnsafeChannel.Unsafe.
It will never be notified of a success or error and so is only a placeholder for operations
that take a ChannelPromise as argument but for which you not want to get notified.voidPromise in interface Channel.Unsafeprotected final boolean ensureOpen(ChannelPromise promise)
protected final void safeSetSuccess(ChannelPromise promise)
promise as success. If the promise is done already, log a message.protected final void safeSetFailure(ChannelPromise promise, Throwable cause)
promise as failure. If the promise is done already, log a message.protected final void closeIfClosed()
protected final Throwable annotateConnectException(Throwable cause, SocketAddress remoteAddress)
protected Executor closeExecutor()
Executor to execute AbstractChannel.doClose() or null if it should be done in the
EventLoop.
+Copyright © 2008–2015 The Netty Project. All rights reserved.