Top Description Inners Methods
io.netty5.handler.codec.http2

public Interface Http2RemoteFlowController

extends Http2FlowController
Known Direct Implementers
io.netty5.handler.codec.http2.DefaultHttp2RemoteFlowController
Annotations
@UnstableApi
Imports
io.netty5.channel.ChannelHandlerContext, io.netty5.util.internal.UnstableApi

A Http2FlowController for controlling the flow of outbound DATA frames to the remote endpoint.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Http2RemoteFlowController.FlowControlled

Implementations of this interface are used to progressively write chunks of the underlying payload to the stream.

public static interface
Http2RemoteFlowController.Listener

Listener to the number of flow-controlled bytes written per stream.

Method Summary

Modifier and TypeMethod and Description
public void
addFlowControlled(Http2Stream
the subject stream. Must not be the connection stream object.
stream
,
Http2RemoteFlowController.FlowControlled
payload to write subject to flow-control accounting and ordering rules.
payload
)

Queues a payload for transmission to the remote endpoint.

public ChannelHandlerContext

Returns:

The ChannelHandlerContext for which to apply flow control on.
channelHandlerContext
()

Get the ChannelHandlerContext for which to apply flow control on.

public void
channelWritabilityChanged()

Notification that the writability of channelHandlerContext() has changed.

public boolean

Returns:

true if stream has any FlowControlled frames currently queued.
hasFlowControlled
(Http2Stream
the stream to check if it has flow controlled frames.
stream
)

Determine if stream has any FlowControlled frames currently queued.

public boolean

Returns:

true if the stream has bytes remaining for use in the flow control window and the channel is writable, false otherwise.
isWritable
(Http2Stream
The stream to test.
stream
)

Determine if the stream has bytes remaining for use in the flow control window.

public void
listener(Http2RemoteFlowController.Listener
to notify when the a write occurs, can be null.
listener
)

Set the active listener on the flow-controller.

public void
updateDependencyTree(int
The stream identifier associated with the child stream.
childStreamId
,
int
The stream identifier associated with the parent stream. May be 0, to make childStreamId and immediate child of the connection.
parentStreamId
,
short
The weight which is used relative to other child streams for parentStreamId. This value must be between 1 and 256 (inclusive).
weight
,
boolean
If childStreamId should be the exclusive dependency of parentStreamId.
exclusive
)

Explicitly update the dependency tree.

public void
writePendingBytes()

Write all data pending in the flow controller up to the flow-control limits.

Inherited from io.netty5.handler.codec.http2.Http2FlowController:
channelHandlerContextincrementWindowSizeinitialWindowSizeinitialWindowSizewindowSize

Method Detail

addFlowControlledback to summary
public void addFlowControlled(Http2Stream stream, Http2RemoteFlowController.FlowControlled payload)

Queues a payload for transmission to the remote endpoint. There is no guarantee as to when the data will be written or how it will be assigned to frames. before sending.

Writes do not actually occur until writePendingBytes() is called.

Parameters
stream:Http2Stream

the subject stream. Must not be the connection stream object.

payload:Http2RemoteFlowController.FlowControlled

payload to write subject to flow-control accounting and ordering rules.

channelHandlerContextback to summary
public ChannelHandlerContext channelHandlerContext()

Get the ChannelHandlerContext for which to apply flow control on.

This is intended for us by FlowControlled implementations only. Use with caution.

Returns:ChannelHandlerContext

The ChannelHandlerContext for which to apply flow control on.

channelWritabilityChangedback to summary
public void channelWritabilityChanged() throws Http2Exception

Notification that the writability of channelHandlerContext() has changed.

Exceptions
Http2Exception:
If any writes occur as a result of this call and encounter errors.
hasFlowControlledback to summary
public boolean hasFlowControlled(Http2Stream stream)

Determine if stream has any FlowControlled frames currently queued.

Parameters
stream:Http2Stream

the stream to check if it has flow controlled frames.

Returns:boolean

true if stream has any FlowControlled frames currently queued.

isWritableback to summary
public boolean isWritable(Http2Stream stream)

Determine if the stream has bytes remaining for use in the flow control window.

Note that this method respects channel writability. The channel must be writable for this method to return true.

Parameters
stream:Http2Stream

The stream to test.

Returns:boolean

true if the stream has bytes remaining for use in the flow control window and the channel is writable, false otherwise.

listenerback to summary
public void listener(Http2RemoteFlowController.Listener listener)

Set the active listener on the flow-controller.

Parameters
listener:Http2RemoteFlowController.Listener

to notify when the a write occurs, can be null.

updateDependencyTreeback to summary
public void updateDependencyTree(int childStreamId, int parentStreamId, short weight, boolean exclusive)

Explicitly update the dependency tree. This method is called independently of stream state changes.

Parameters
childStreamId:int

The stream identifier associated with the child stream.

parentStreamId:int

The stream identifier associated with the parent stream. May be 0, to make childStreamId and immediate child of the connection.

weight:short

The weight which is used relative to other child streams for parentStreamId. This value must be between 1 and 256 (inclusive).

exclusive:boolean

If childStreamId should be the exclusive dependency of parentStreamId.

writePendingBytesback to summary
public void writePendingBytes() throws Http2Exception

Write all data pending in the flow controller up to the flow-control limits.

Exceptions
Http2Exception:
throws if a protocol-related error occurred.
io.netty5.handler.codec.http2 back to summary

public Interface Http2RemoteFlowController.FlowControlled

Known Direct Implementers
io.netty5.handler.codec.http2.DefaultHttp2ConnectionEncoder.FlowControlledBase

Implementations of this interface are used to progressively write chunks of the underlying payload to the stream. A payload is considered to be fully written if write has been called at least once and it's size is now zero.

Method Summary

Modifier and TypeMethod and Description
public void
error(ChannelHandlerContext
The context to use if any communication needs to occur as a result of the error. This may be null if an exception occurs when the connection has not been established yet.
ctx
,
Throwable
of the error.
cause
)

Called to indicate that an error occurred before this object could be completely written.

public boolean

Returns:

true if next was successfully merged and does not need to be enqueued, false otherwise.
merge
(ChannelHandlerContext ctx, Http2RemoteFlowController.FlowControlled next)

Merge the contents of the next message into this message so they can be written out as one unit.

public int
size()

The size of the payload in terms of bytes applied to the flow-control window.

public void
write(ChannelHandlerContext
The context to use for writing.
ctx
,
int
an upper bound on the number of bytes the payload can write at this time.
allowedBytes
)

Writes up to allowedBytes of the encapsulated payload to the stream.

public void
writeComplete()

Called after this object has been successfully written.

Method Detail

errorback to summary
public void error(ChannelHandlerContext ctx, Throwable cause)

Called to indicate that an error occurred before this object could be completely written.

The Http2RemoteFlowController will make exactly one call to either this method or writeComplete().

Parameters
ctx:ChannelHandlerContext

The context to use if any communication needs to occur as a result of the error. This may be null if an exception occurs when the connection has not been established yet.

cause:Throwable

of the error.

mergeback to summary
public boolean merge(ChannelHandlerContext ctx, Http2RemoteFlowController.FlowControlled next)

Merge the contents of the next message into this message so they can be written out as one unit. This allows many small messages to be written as a single DATA frame.

Returns:boolean

true if next was successfully merged and does not need to be enqueued, false otherwise.

sizeback to summary
public int size()

The size of the payload in terms of bytes applied to the flow-control window. Some payloads like HEADER frames have no cost against flow control and would return 0 for this value even though they produce a non-zero number of bytes on the wire. Other frames like DATA frames have both their payload and padding count against flow-control.

writeback to summary
public void write(ChannelHandlerContext ctx, int allowedBytes)

Writes up to allowedBytes of the encapsulated payload to the stream. Note that a value of 0 may be passed which will allow payloads with flow-control size == 0 to be written. The flow-controller may call this method multiple times with different values until the payload is fully written, i.e it's size after the write is 0.

When an exception is thrown the Http2RemoteFlowController will make a call to error(ChannelHandlerContext, Throwable).

Parameters
ctx:ChannelHandlerContext

The context to use for writing.

allowedBytes:int

an upper bound on the number of bytes the payload can write at this time.

writeCompleteback to summary
public void writeComplete()

Called after this object has been successfully written.

The Http2RemoteFlowController will make exactly one call to either this method or error(ChannelHandlerContext, Throwable).

io.netty5.handler.codec.http2 back to summary

public Interface Http2RemoteFlowController.Listener

Known Direct Implementers
io.netty5.handler.codec.http2.Http2FrameCodec.Http2RemoteFlowControllerListener

Listener to the number of flow-controlled bytes written per stream.

Method Summary

Modifier and TypeMethod and Description
public void
writabilityChanged(Http2Stream
The stream which writability has changed for.
stream
)

Notification that Http2RemoteFlowController#isWritable(Http2Stream) has changed for stream.

Method Detail

writabilityChangedback to summary
public void writabilityChanged(Http2Stream stream)

Notification that Http2RemoteFlowController#isWritable(Http2Stream) has changed for stream.

This method should not throw. Any thrown exceptions are considered a programming error and are ignored.

Parameters
stream:Http2Stream

The stream which writability has changed for.