Package io.netty.handler.codec.http2
Class AbstractHttp2StreamChannel.Http2ChannelUnsafe
- java.lang.Object
-
- io.netty.handler.codec.http2.AbstractHttp2StreamChannel.Http2ChannelUnsafe
-
- All Implemented Interfaces:
Channel.Unsafe
- Enclosing class:
- AbstractHttp2StreamChannel
private final class AbstractHttp2StreamChannel.Http2ChannelUnsafe extends java.lang.Object implements Channel.Unsafe
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
closeInitiated
private boolean
readEOS
private boolean
receivedEndOfStream
private RecvByteBufAllocator.Handle
recvHandle
private boolean
sentEndOfStream
private VoidChannelPromise
unsafeVoidPromise
private boolean
writeDoneAndNoFlush
-
Constructor Summary
Constructors Modifier Constructor Description private
Http2ChannelUnsafe()
-
Method Summary
All Methods Instance Methods Concrete 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.(package private) void
close(ChannelPromise promise, Http2Error error)
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.(package private) void
doBeginRead()
(package private) void
doRead0(Http2Frame frame, RecvByteBufAllocator.Handle allocHandle)
private void
fireChannelInactiveAndDeregister(ChannelPromise promise, boolean fireChannelInactive)
private void
firstWriteComplete(ChannelFuture future, ChannelPromise promise)
void
flush()
Flush out all write operations scheduled viaChannel.Unsafe.write(Object, ChannelPromise)
.private void
invokeLater(Channel channel, java.lang.Runnable task)
private boolean
isEndOfStream(Http2Frame frame)
java.net.SocketAddress
localAddress()
Return theSocketAddress
to which is bound local ornull
if none.(package private) void
notifyReadComplete(RecvByteBufAllocator.Handle allocHandle, boolean forceReadComplete, boolean inReadLoop)
ChannelOutboundBuffer
outboundBuffer()
Returns theChannelOutboundBuffer
of theChannel
where the pending write requests are stored.private java.lang.Object
pollQueuedMessage()
(package private) void
readEOS()
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.private void
resetReadStatus()
private void
safeSetSuccess(ChannelPromise promise)
private boolean
updateLocalWindowIfNeeded()
(package private) void
updateLocalWindowIfNeededAndFlush()
private Http2StreamFrame
validateStreamFrame(Http2StreamFrame frame)
ChannelPromise
voidPromise()
Return a special ChannelPromise which can be reused and passed to the operations inChannel.Unsafe
.private java.lang.Throwable
wrapStreamClosedError(java.lang.Throwable cause)
void
write(java.lang.Object msg, ChannelPromise promise)
Schedules a write operation.private void
writeComplete(ChannelFuture future, ChannelPromise promise)
private void
writeHttp2StreamFrame(Http2StreamFrame frame, ChannelPromise promise)
private ChannelFuture
writeWindowUpdateFrame(Http2WindowUpdateFrame windowUpdateFrame)
-
-
-
Field Detail
-
unsafeVoidPromise
private final VoidChannelPromise unsafeVoidPromise
-
recvHandle
private RecvByteBufAllocator.Handle recvHandle
-
writeDoneAndNoFlush
private boolean writeDoneAndNoFlush
-
closeInitiated
private boolean closeInitiated
-
readEOS
private boolean readEOS
-
receivedEndOfStream
private boolean receivedEndOfStream
-
sentEndOfStream
private boolean sentEndOfStream
-
-
Method Detail
-
connect
public void connect(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, ChannelPromise promise)
Description copied from interface:Channel.Unsafe
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.- Specified by:
connect
in interfaceChannel.Unsafe
-
recvBufAllocHandle
public RecvByteBufAllocator.Handle recvBufAllocHandle()
Description copied from interface:Channel.Unsafe
Return the assignedRecvByteBufAllocator.Handle
which will be used to allocateByteBuf
's when receiving data.- Specified by:
recvBufAllocHandle
in interfaceChannel.Unsafe
-
localAddress
public java.net.SocketAddress localAddress()
Description copied from interface:Channel.Unsafe
Return theSocketAddress
to which is bound local ornull
if none.- Specified by:
localAddress
in interfaceChannel.Unsafe
-
remoteAddress
public java.net.SocketAddress remoteAddress()
Description copied from interface:Channel.Unsafe
Return theSocketAddress
to which is bound remote ornull
if none is bound yet.- Specified by:
remoteAddress
in interfaceChannel.Unsafe
-
register
public void register(EventLoop eventLoop, ChannelPromise promise)
Description copied from interface:Channel.Unsafe
Register theChannel
of theChannelPromise
and notify theChannelFuture
once the registration was complete.- Specified by:
register
in interfaceChannel.Unsafe
-
bind
public void bind(java.net.SocketAddress localAddress, ChannelPromise promise)
Description copied from interface:Channel.Unsafe
- Specified by:
bind
in interfaceChannel.Unsafe
-
disconnect
public void disconnect(ChannelPromise promise)
Description copied from interface:Channel.Unsafe
Disconnect theChannel
of theChannelFuture
and notify theChannelPromise
once the operation was complete.- Specified by:
disconnect
in interfaceChannel.Unsafe
-
close
public void close(ChannelPromise promise)
Description copied from interface:Channel.Unsafe
Close theChannel
of theChannelPromise
and notify theChannelPromise
once the operation was complete.- Specified by:
close
in interfaceChannel.Unsafe
-
close
void close(ChannelPromise promise, Http2Error error)
-
closeForcibly
public void closeForcibly()
Description copied from interface:Channel.Unsafe
Closes theChannel
immediately without firing any events. Probably only useful when registration attempt failed.- Specified by:
closeForcibly
in interfaceChannel.Unsafe
-
deregister
public void deregister(ChannelPromise promise)
Description copied from interface:Channel.Unsafe
Deregister theChannel
of theChannelPromise
fromEventLoop
and notify theChannelPromise
once the operation was complete.- Specified by:
deregister
in interfaceChannel.Unsafe
-
fireChannelInactiveAndDeregister
private void fireChannelInactiveAndDeregister(ChannelPromise promise, boolean fireChannelInactive)
-
safeSetSuccess
private void safeSetSuccess(ChannelPromise promise)
-
invokeLater
private void invokeLater(Channel channel, java.lang.Runnable task)
-
beginRead
public void beginRead()
Description copied from interface:Channel.Unsafe
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.- Specified by:
beginRead
in interfaceChannel.Unsafe
-
pollQueuedMessage
private java.lang.Object pollQueuedMessage()
-
doBeginRead
void doBeginRead()
-
readEOS
void readEOS()
-
updateLocalWindowIfNeeded
private boolean updateLocalWindowIfNeeded()
-
updateLocalWindowIfNeededAndFlush
void updateLocalWindowIfNeededAndFlush()
-
resetReadStatus
private void resetReadStatus()
-
notifyReadComplete
void notifyReadComplete(RecvByteBufAllocator.Handle allocHandle, boolean forceReadComplete, boolean inReadLoop)
-
doRead0
void doRead0(Http2Frame frame, RecvByteBufAllocator.Handle allocHandle)
-
writeWindowUpdateFrame
private ChannelFuture writeWindowUpdateFrame(Http2WindowUpdateFrame windowUpdateFrame)
-
write
public void write(java.lang.Object msg, ChannelPromise promise)
Description copied from interface:Channel.Unsafe
Schedules a write operation.- Specified by:
write
in interfaceChannel.Unsafe
-
isEndOfStream
private boolean isEndOfStream(Http2Frame frame)
-
writeHttp2StreamFrame
private void writeHttp2StreamFrame(Http2StreamFrame frame, ChannelPromise promise)
-
firstWriteComplete
private void firstWriteComplete(ChannelFuture future, ChannelPromise promise)
-
writeComplete
private void writeComplete(ChannelFuture future, ChannelPromise promise)
-
wrapStreamClosedError
private java.lang.Throwable wrapStreamClosedError(java.lang.Throwable cause)
-
validateStreamFrame
private Http2StreamFrame validateStreamFrame(Http2StreamFrame frame)
-
flush
public void flush()
Description copied from interface:Channel.Unsafe
Flush out all write operations scheduled viaChannel.Unsafe.write(Object, ChannelPromise)
.- Specified by:
flush
in interfaceChannel.Unsafe
-
voidPromise
public ChannelPromise voidPromise()
Description copied from interface:Channel.Unsafe
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.- Specified by:
voidPromise
in interfaceChannel.Unsafe
-
outboundBuffer
public ChannelOutboundBuffer outboundBuffer()
Description copied from interface:Channel.Unsafe
Returns theChannelOutboundBuffer
of theChannel
where the pending write requests are stored.- Specified by:
outboundBuffer
in interfaceChannel.Unsafe
-
-