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 boolean
inWritePendingBytes
private long
totalPendingBytes
-
Constructor Summary
Constructors Modifier Constructor Description private
WritabilityMonitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
channelWritabilityChange()
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) 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) boolean
isWritable(DefaultHttp2RemoteFlowController.FlowState state)
Determine if the stream associated withstate
is writable.(package private) boolean
isWritableConnection()
(package private) void
stateCancelled(DefaultHttp2RemoteFlowController.FlowState state)
Called when the state is cancelled.(package private) void
windowSize(DefaultHttp2RemoteFlowController.FlowState state, int initialWindowSize)
Set the initial window size forstate
.void
write(Http2Stream stream, int numBytes)
Writes the allocated bytes for this stream.(package private) void
writePendingBytes()
-
-
-
Method Detail
-
write
public final void write(Http2Stream stream, int numBytes)
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
void channelWritabilityChange() throws Http2Exception
Called 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 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
final boolean isWritable(DefaultHttp2RemoteFlowController.FlowState state)
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
final void writePendingBytes() throws Http2Exception
- Throws:
Http2Exception
-
initialWindowSize
void initialWindowSize(int newWindowSize) throws Http2Exception
- Throws:
Http2Exception
-
isWritableConnection
final boolean isWritableConnection()
-
-