Package io.netty.handler.codec.http2
Class DefaultHttp2RemoteFlowController.ListenerWritabilityMonitor
- java.lang.Object
-
- io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController.WritabilityMonitor
-
- io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController.ListenerWritabilityMonitor
-
- All Implemented Interfaces:
Http2StreamVisitor
,StreamByteDistributor.Writer
- Enclosing class:
- DefaultHttp2RemoteFlowController
private final class DefaultHttp2RemoteFlowController.ListenerWritabilityMonitor extends DefaultHttp2RemoteFlowController.WritabilityMonitor implements Http2StreamVisitor
Writability of astream
is calculated using the following:Connection Window - Total Queued Bytes > 0 && Stream Window - Bytes Queued for Stream > 0 && isChannelWritable()
-
-
Field Summary
Fields Modifier and Type Field Description private Http2RemoteFlowController.Listener
listener
-
Constructor Summary
Constructors Constructor Description ListenerWritabilityMonitor(Http2RemoteFlowController.Listener listener)
-
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.private void
checkAllWritabilityChanged()
private void
checkConnectionThenStreamWritabilityChanged(DefaultHttp2RemoteFlowController.FlowState state)
private void
checkStateWritability(DefaultHttp2RemoteFlowController.FlowState state)
(package private) void
enqueueFrame(DefaultHttp2RemoteFlowController.FlowState state, Http2RemoteFlowController.FlowControlled frame)
Add a frame to be sent via flow control.(package private) void
incrementWindowSize(DefaultHttp2RemoteFlowController.FlowState state, int delta)
Increment the window size for a particular stream.(package private) void
initialWindowSize(int newWindowSize)
private void
notifyWritabilityChanged(DefaultHttp2RemoteFlowController.FlowState state)
(package private) void
stateCancelled(DefaultHttp2RemoteFlowController.FlowState state)
Called when the state is cancelled.boolean
visit(Http2Stream stream)
(package private) void
windowSize(DefaultHttp2RemoteFlowController.FlowState state, int initialWindowSize)
Set the initial window size forstate
.-
Methods inherited from class io.netty.handler.codec.http2.DefaultHttp2RemoteFlowController.WritabilityMonitor
incrementPendingBytes, isWritable, isWritableConnection, write, writePendingBytes
-
-
-
-
Field Detail
-
listener
private final Http2RemoteFlowController.Listener listener
-
-
Constructor Detail
-
ListenerWritabilityMonitor
ListenerWritabilityMonitor(Http2RemoteFlowController.Listener listener)
-
-
Method Detail
-
visit
public boolean visit(Http2Stream stream) throws Http2Exception
- Specified by:
visit
in interfaceHttp2StreamVisitor
- Returns:
true
if the visitor wants to continue the loop and handle the entry.false
if the visitor wants to stop handling headers and abort the loop.
- Throws:
Http2Exception
-
windowSize
void windowSize(DefaultHttp2RemoteFlowController.FlowState state, int initialWindowSize)
Description copied from class:DefaultHttp2RemoteFlowController.WritabilityMonitor
Set the initial window size forstate
.- Overrides:
windowSize
in classDefaultHttp2RemoteFlowController.WritabilityMonitor
- 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
Description copied from class:DefaultHttp2RemoteFlowController.WritabilityMonitor
Increment the window size for a particular stream.- Overrides:
incrementWindowSize
in classDefaultHttp2RemoteFlowController.WritabilityMonitor
- 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
.
-
initialWindowSize
void initialWindowSize(int newWindowSize) throws Http2Exception
- Overrides:
initialWindowSize
in classDefaultHttp2RemoteFlowController.WritabilityMonitor
- Throws:
Http2Exception
-
enqueueFrame
void enqueueFrame(DefaultHttp2RemoteFlowController.FlowState state, Http2RemoteFlowController.FlowControlled frame) throws Http2Exception
Description copied from class:DefaultHttp2RemoteFlowController.WritabilityMonitor
Add a frame to be sent via flow control.- Overrides:
enqueueFrame
in classDefaultHttp2RemoteFlowController.WritabilityMonitor
- 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.
-
stateCancelled
void stateCancelled(DefaultHttp2RemoteFlowController.FlowState state)
Description copied from class:DefaultHttp2RemoteFlowController.WritabilityMonitor
Called when the state is cancelled.- Overrides:
stateCancelled
in classDefaultHttp2RemoteFlowController.WritabilityMonitor
- Parameters:
state
- the state that was cancelled.
-
channelWritabilityChange
void channelWritabilityChange() throws Http2Exception
Description copied from class:DefaultHttp2RemoteFlowController.WritabilityMonitor
Called when the writability of the underlying channel changes.- Overrides:
channelWritabilityChange
in classDefaultHttp2RemoteFlowController.WritabilityMonitor
- Throws:
Http2Exception
- If a write occurs and an exception happens in the write operation.
-
checkStateWritability
private void checkStateWritability(DefaultHttp2RemoteFlowController.FlowState state) throws Http2Exception
- Throws:
Http2Exception
-
notifyWritabilityChanged
private void notifyWritabilityChanged(DefaultHttp2RemoteFlowController.FlowState state)
-
checkConnectionThenStreamWritabilityChanged
private void checkConnectionThenStreamWritabilityChanged(DefaultHttp2RemoteFlowController.FlowState state) throws Http2Exception
- Throws:
Http2Exception
-
checkAllWritabilityChanged
private void checkAllWritabilityChanged() throws Http2Exception
- Throws:
Http2Exception
-
-