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.UnsafeUnsafe 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 voidbeginRead()Schedules a read operation that fills the inbound buffer of the firstChannelInboundHandlerin theChannelPipeline.voidbind(java.net.SocketAddress localAddress, ChannelPromise promise)voidclose(ChannelPromise promise)Close theChannelof theChannelPromiseand notify theChannelPromiseonce the operation was complete.voidcloseForcibly()Closes theChannelimmediately without firing any events.voidconnect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)voidderegister(ChannelPromise promise)Deregister theChannelof theChannelPromisefromEventLoopand notify theChannelPromiseonce the operation was complete.voiddisconnect(ChannelPromise promise)Disconnect theChannelof theChannelFutureand notify theChannelPromiseonce the operation was complete.voidflush()Flush out all write operations scheduled viawrite(Object, ChannelPromise).java.net.SocketAddresslocalAddress()Return theSocketAddressto which is bound local ornullif none.ChannelOutboundBufferoutboundBuffer()Returns theChannelOutboundBufferof theChannelwhere the pending write requests are stored.RecvByteBufAllocator.HandlerecvBufAllocHandle()Return the assignedRecvByteBufAllocator.Handlewhich will be used to allocateByteBuf's when receiving data.voidregister(EventLoop eventLoop, ChannelPromise promise)Register theChannelof theChannelPromiseand notify theChannelFutureonce the registration was complete.java.net.SocketAddressremoteAddress()Return theSocketAddressto which is bound remote ornullif none is bound yet.ChannelPromisevoidPromise()Return a special ChannelPromise which can be reused and passed to the operations inChannel.Unsafe.voidwrite(java.lang.Object msg, ChannelPromise promise)Schedules a write operation.
-
-
-
Method Detail
-
recvBufAllocHandle
RecvByteBufAllocator.Handle recvBufAllocHandle()
Return the assignedRecvByteBufAllocator.Handlewhich will be used to allocateByteBuf's when receiving data.
-
localAddress
java.net.SocketAddress localAddress()
Return theSocketAddressto which is bound local ornullif none.
-
remoteAddress
java.net.SocketAddress remoteAddress()
Return theSocketAddressto which is bound remote ornullif none is bound yet.
-
register
void register(EventLoop eventLoop, ChannelPromise promise)
Register theChannelof theChannelPromiseand notify theChannelFutureonce 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 theChannelof the givenChannelFuturewith the given remoteSocketAddress. If a specific localSocketAddressshould be used it need to be given as argument. Otherwise just passnullto it. TheChannelPromisewill get notified once the connect operation was complete.
-
disconnect
void disconnect(ChannelPromise promise)
Disconnect theChannelof theChannelFutureand notify theChannelPromiseonce the operation was complete.
-
close
void close(ChannelPromise promise)
Close theChannelof theChannelPromiseand notify theChannelPromiseonce the operation was complete.
-
closeForcibly
void closeForcibly()
Closes theChannelimmediately without firing any events. Probably only useful when registration attempt failed.
-
deregister
void deregister(ChannelPromise promise)
Deregister theChannelof theChannelPromisefromEventLoopand notify theChannelPromiseonce the operation was complete.
-
beginRead
void beginRead()
Schedules a read operation that fills the inbound buffer of the firstChannelInboundHandlerin 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 aChannelPromiseas argument but for which you not want to get notified.
-
outboundBuffer
ChannelOutboundBuffer outboundBuffer()
Returns theChannelOutboundBufferof theChannelwhere the pending write requests are stored.
-
-