Package io.netty.handler.codec.http2
Class DefaultHttp2RemoteFlowController.WritabilityMonitor
java.lang.Object
io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController.WritabilityMonitor
- All Implemented Interfaces:
StreamByteDistributor.Writer
- Direct Known Subclasses:
DefaultHttp2RemoteFlowController.ListenerWritabilityMonitor
- Enclosing class:
DefaultHttp2RemoteFlowController
private class DefaultHttp2RemoteFlowController.WritabilityMonitor
extends Object
implements StreamByteDistributor.Writer
Abstract class which provides common functionality for writability monitor implementations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
Called when the writability of the underlying channel changes.(package private) void
enqueueFrame
(DefaultHttp2RemoteFlowController.FlowState state, Http2RemoteFlowController.FlowControlled frame) Add a frame to be sent via flow control.(package private) final void
incrementPendingBytes
(int delta) Increment the total amount of pending bytes for all streams.(package private) void
incrementWindowSize
(DefaultHttp2RemoteFlowController.FlowState state, int delta) Increment the window size for a particular stream.(package private) void
initialWindowSize
(int newWindowSize) (package private) final boolean
Determine if the stream associated withstate
is writable.(package private) final boolean
(package private) void
Called when the state is cancelled.(package private) void
windowSize
(DefaultHttp2RemoteFlowController.FlowState state, int initialWindowSize) Set the initial window size forstate
.final void
write
(Http2Stream stream, int numBytes) Writes the allocated bytes for this stream.(package private) final void
-
Field Details
-
inWritePendingBytes
private boolean inWritePendingBytes -
totalPendingBytes
private long totalPendingBytes
-
-
Constructor Details
-
WritabilityMonitor
private WritabilityMonitor()
-
-
Method Details
-
write
Description copied from interface:StreamByteDistributor.Writer
Writes the allocated bytes for this stream.Any
Throwable
thrown from this method is considered a programming error. AGOAWAY
frame will be sent and the will be connection closed.- Specified by:
write
in interfaceStreamByteDistributor.Writer
- Parameters:
stream
- the stream for which to perform the write.numBytes
- the number of bytes to write.
-
channelWritabilityChange
Called when the writability of the underlying channel changes.- Throws:
Http2Exception
- If a write occurs and an exception happens in the write operation.
-
stateCancelled
Called when the state is cancelled.- Parameters:
state
- the state that was cancelled.
-
windowSize
Set the initial window size forstate
.- Parameters:
state
- the state to change the initial window size for.initialWindowSize
- the size of the window in bytes.
-
incrementWindowSize
void incrementWindowSize(DefaultHttp2RemoteFlowController.FlowState state, int delta) throws Http2Exception Increment the window size for a particular stream.- Parameters:
state
- the state associated with the stream whose window is being incremented.delta
- The amount to increment by.- Throws:
Http2Exception
- If this operation overflows the window forstate
.
-
enqueueFrame
void enqueueFrame(DefaultHttp2RemoteFlowController.FlowState state, Http2RemoteFlowController.FlowControlled frame) throws Http2Exception Add a frame to be sent via flow control.- Parameters:
state
- The state associated with the stream which theframe
is associated with.frame
- the frame to enqueue.- Throws:
Http2Exception
- If a writability error occurs.
-
incrementPendingBytes
final void incrementPendingBytes(int delta) Increment the total amount of pending bytes for all streams. When any stream's pending bytes changes method should be called.- Parameters:
delta
- The amount to increment by.
-
isWritable
Determine if the stream associated withstate
is writable.- Parameters:
state
- The state which is associated with the stream to test writability for.- Returns:
true
ifDefaultHttp2RemoteFlowController.FlowState.stream()
is writable.false
otherwise.
-
writePendingBytes
- Throws:
Http2Exception
-
initialWindowSize
- Throws:
Http2Exception
-
isWritableConnection
final boolean isWritableConnection()
-