Package io.netty.channel
Interface Channel.Unsafe
-
- All Known Subinterfaces:
AbstractNioChannel.NioUnsafe
- All Known Implementing Classes:
AbstractChannel.AbstractUnsafe
,AbstractNioByteChannel.NioByteUnsafe
,AbstractNioChannel.AbstractNioUnsafe
- Enclosing interface:
- Channel
public static interface Channel.Unsafe
Unsafe operations that should never be called from user-code. These methods are only provided to implement the actual transport, and must be invoked from an I/O thread except for the following methods:
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
beginRead()
Schedules a read operation that fills the inbound buffer of the firstChannelInboundHandler
in theChannelPipeline
.void
bind(java.net.SocketAddress localAddress, ChannelPromise promise)
void
close(ChannelPromise promise)
Close theChannel
of theChannelPromise
and notify theChannelPromise
once the operation was complete.void
closeForcibly()
Closes theChannel
immediately without firing any events.void
connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)
void
deregister(ChannelPromise promise)
Deregister theChannel
of theChannelPromise
fromEventLoop
and notify theChannelPromise
once the operation was complete.void
disconnect(ChannelPromise promise)
Disconnect theChannel
of theChannelFuture
and notify theChannelPromise
once the operation was complete.void
flush()
Flush out all write operations scheduled viawrite(Object, ChannelPromise)
.java.net.SocketAddress
localAddress()
Return theSocketAddress
to which is bound local ornull
if none.ChannelOutboundBuffer
outboundBuffer()
Returns theChannelOutboundBuffer
of theChannel
where the pending write requests are stored.RecvByteBufAllocator.Handle
recvBufAllocHandle()
Return the assignedRecvByteBufAllocator.Handle
which will be used to allocateByteBuf
's when receiving data.void
register(EventLoop eventLoop, ChannelPromise promise)
Register theChannel
of theChannelPromise
and notify theChannelFuture
once the registration was complete.java.net.SocketAddress
remoteAddress()
Return theSocketAddress
to which is bound remote ornull
if none is bound yet.ChannelPromise
voidPromise()
Return a special ChannelPromise which can be reused and passed to the operations inChannel.Unsafe
.void
write(java.lang.Object msg, ChannelPromise promise)
Schedules a write operation.
-
-
-
Method Detail
-
recvBufAllocHandle
RecvByteBufAllocator.Handle recvBufAllocHandle()
Return the assignedRecvByteBufAllocator.Handle
which will be used to allocateByteBuf
's when receiving data.
-
localAddress
java.net.SocketAddress localAddress()
Return theSocketAddress
to which is bound local ornull
if none.
-
remoteAddress
java.net.SocketAddress remoteAddress()
Return theSocketAddress
to which is bound remote ornull
if none is bound yet.
-
register
void register(EventLoop eventLoop, ChannelPromise promise)
Register theChannel
of theChannelPromise
and notify theChannelFuture
once the registration was complete.
-
bind
void bind(java.net.SocketAddress localAddress, ChannelPromise promise)
-
connect
void connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)
Connect theChannel
of the givenChannelFuture
with the given remoteSocketAddress
. If a specific localSocketAddress
should be used it need to be given as argument. Otherwise just passnull
to it. TheChannelPromise
will get notified once the connect operation was complete.
-
disconnect
void disconnect(ChannelPromise promise)
Disconnect theChannel
of theChannelFuture
and notify theChannelPromise
once the operation was complete.
-
close
void close(ChannelPromise promise)
Close theChannel
of theChannelPromise
and notify theChannelPromise
once the operation was complete.
-
closeForcibly
void closeForcibly()
Closes theChannel
immediately without firing any events. Probably only useful when registration attempt failed.
-
deregister
void deregister(ChannelPromise promise)
Deregister theChannel
of theChannelPromise
fromEventLoop
and notify theChannelPromise
once the operation was complete.
-
beginRead
void beginRead()
Schedules a read operation that fills the inbound buffer of the firstChannelInboundHandler
in theChannelPipeline
. If there's already a pending read operation, this method does nothing.
-
write
void write(java.lang.Object msg, ChannelPromise promise)
Schedules a write operation.
-
flush
void flush()
Flush out all write operations scheduled viawrite(Object, ChannelPromise)
.
-
voidPromise
ChannelPromise voidPromise()
Return 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 aChannelPromise
as argument but for which you not want to get notified.
-
outboundBuffer
ChannelOutboundBuffer outboundBuffer()
Returns theChannelOutboundBuffer
of theChannel
where the pending write requests are stored.
-
-