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 java.lang.Object
implements StreamByteDistributor.Writer
Abstract class which provides common functionality for writability monitor implementations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidCalled when the writability of the underlying channel changes.(package private) voidenqueueFrame(DefaultHttp2RemoteFlowController.FlowState state, Http2RemoteFlowController.FlowControlled frame) Add a frame to be sent via flow control.(package private) final voidincrementPendingBytes(int delta) Increment the total amount of pending bytes for all streams.(package private) voidincrementWindowSize(DefaultHttp2RemoteFlowController.FlowState state, int delta) Increment the window size for a particular stream.(package private) voidinitialWindowSize(int newWindowSize) (package private) final booleanDetermine if the stream associated withstateis writable.(package private) final boolean(package private) voidCalled when the state is cancelled.(package private) voidwindowSize(DefaultHttp2RemoteFlowController.FlowState state, int initialWindowSize) Set the initial window size forstate.final voidwrite(Http2Stream stream, int numBytes) Writes the allocated bytes for this stream.(package private) final voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
inWritePendingBytes
private boolean inWritePendingBytes -
totalPendingBytes
private long totalPendingBytes
-
-
Constructor Details
-
WritabilityMonitor
private WritabilityMonitor()
-
-
Method Details
-
write
Description copied from interface:StreamByteDistributor.WriterWrites the allocated bytes for this stream.Any
Throwablethrown from this method is considered a programming error. AGOAWAYframe will be sent and the will be connection closed.- Specified by:
writein 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 theframeis 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 withstateis writable.- Parameters:
state- The state which is associated with the stream to test writability for.- Returns:
trueifDefaultHttp2RemoteFlowController.FlowState.stream()is writable.falseotherwise.
-
writePendingBytes
- Throws:
Http2Exception
-
initialWindowSize
- Throws:
Http2Exception
-
isWritableConnection
final boolean isWritableConnection()
-