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 java.lang.Object implements StreamByteDistributor.Writer
Abstract class which provides common functionality for writability monitor implementations.
-
-
Field Summary
Fields Modifier and Type Field Description private booleaninWritePendingBytesprivate longtotalPendingBytes
-
Constructor Summary
Constructors Modifier Constructor Description privateWritabilityMonitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidchannelWritabilityChange()Called 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) 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) booleanisWritable(DefaultHttp2RemoteFlowController.FlowState state)Determine if the stream associated withstateis writable.(package private) booleanisWritableConnection()(package private) voidstateCancelled(DefaultHttp2RemoteFlowController.FlowState state)Called when the state is cancelled.(package private) voidwindowSize(DefaultHttp2RemoteFlowController.FlowState state, int initialWindowSize)Set the initial window size forstate.voidwrite(Http2Stream stream, int numBytes)Writes the allocated bytes for this stream.(package private) voidwritePendingBytes()
-
-
-
Method Detail
-
write
public final void write(Http2Stream stream, int numBytes)
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
void channelWritabilityChange() throws Http2ExceptionCalled when the writability of the underlying channel changes.- Throws:
Http2Exception- If a write occurs and an exception happens in the write operation.
-
stateCancelled
void stateCancelled(DefaultHttp2RemoteFlowController.FlowState state)
Called when the state is cancelled.- Parameters:
state- the state that was cancelled.
-
windowSize
void windowSize(DefaultHttp2RemoteFlowController.FlowState state, int initialWindowSize)
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
final boolean isWritable(DefaultHttp2RemoteFlowController.FlowState state)
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
final void writePendingBytes() throws Http2Exception- Throws:
Http2Exception
-
initialWindowSize
void initialWindowSize(int newWindowSize) throws Http2Exception- Throws:
Http2Exception
-
isWritableConnection
final boolean isWritableConnection()
-
-