APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.net.http

pack-priv abstract Class WindowUpdateSender

extends Object
Class Inheritance
Known Direct Subclasses
jdk.internal.net.http.Http2Connection.ConnectionWindowUpdateSender, jdk.internal.net.http.Stream.StreamWindowUpdateSender
Imports
jdk.internal.net.http.common.FlowTube, .Logger, .Utils, jdk.internal.net.http.frame.SettingsFrame, .WindowUpdateFrame, java.util.concurrent.atomic.AtomicInteger, .AtomicLong, java.util.concurrent.locks.ReentrantLock

A class that tracks the amount of flow controlled data received on an HTTP/2 connection

Field Summary

Modifier and TypeField and Description
pack-priv final Http2Connection
pack-priv volatile String
pack-priv final Logger
pack-priv final int
pack-priv final AtomicLong
pack-priv final ReentrantLock
pack-priv final AtomicLong
pack-priv final int

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
WindowUpdateSender(Http2Connection connection, int initWindowSize)

pack-priv
WindowUpdateSender(Http2Connection connection, int maxFrameSize, int initWindowSize)

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean

Returns:

true if buffering the given amount of flow controlled data would not exceed the flow control window
canBufferUnprocessedBytes
(int
a number of unprocessed bytes, which the caller wants to buffer.
len
)

Returns true if buffering the given amount of flow controlled data would not exceed the flow control window.

private boolean
checkWindowSizeExceeded(long processed, long len)

pack-priv String
pack-priv abstract int
pack-priv void
processed(int
the amount of processed bytes to release
delta
)

Called after unprocessed buffered bytes have been processed, to release part of the flow control window

pack-priv long

Returns:

the amount of remaining unprocessed bytes
released
(int
the amount of bytes to release from the window
delta
)

Called when it is desired to release unprocessed bytes without processing them, or without triggering the sending of a window update.

pack-priv void
sendWindowUpdate(int delta)

pack-priv void
update(int
the amount of bytes released from the window.
delta
)

This method is called to update the flow control window, and possibly send a window update

protected abstract boolean

Returns:

true if the error was reported to the peer and no further window update should be sent.
windowSizeExceeded
(long
the amount of data received, which is greater than windowSize
received
)

Called when the flow control window size is exceeded This method may return false if flow control is disabled in this endpoint.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectionback to summary
pack-priv final Http2Connection connection
dbgStringback to summary
pack-priv volatile String dbgString
debugback to summary
pack-priv final Logger debug
limitback to summary
pack-priv final int limit
receivedback to summary
pack-priv final AtomicLong received
sendLockback to summary
pack-priv final ReentrantLock sendLock
unprocessedback to summary
pack-priv final AtomicLong unprocessed
windowSizeback to summary
pack-priv final int windowSize

Constructor Detail

WindowUpdateSenderback to summary
pack-priv WindowUpdateSender(Http2Connection connection)
WindowUpdateSenderback to summary
pack-priv WindowUpdateSender(Http2Connection connection, int initWindowSize)
WindowUpdateSenderback to summary
pack-priv WindowUpdateSender(Http2Connection connection, int maxFrameSize, int initWindowSize)

Method Detail

canBufferUnprocessedBytesback to summary
pack-priv boolean canBufferUnprocessedBytes(int len)

Returns true if buffering the given amount of flow controlled data would not exceed the flow control window.

This method is called before buffering and processing a DataFrame. The count of unprocessed bytes is incremented by the given amount, and checked against the number of available bytes in the flow control window.

This method returns true if the bytes can be buffered without exceeding the flow control window, false if the flow control window is exceeded and corrective action (close/reset) has been taken.

When this method returns true, either processed(int) or released(int) must eventually be called to release the bytes from the flow control window.

Implementation Specification

an HTTP/2 endpoint may disable its own flow control (see RFC 9113, section 5.2.1), in which case this method may return true even if the flow control window would be exceeded: that is, the flow control window is exceeded but the endpoint decided to take no corrective action.

Parameters
len:int

a number of unprocessed bytes, which the caller wants to buffer.

Returns:boolean

true if buffering the given amount of flow controlled data would not exceed the flow control window

checkWindowSizeExceededback to summary
private boolean checkWindowSizeExceeded(long processed, long len)
dbgStringback to summary
pack-priv String dbgString()
getStreamIdback to summary
pack-priv abstract int getStreamId()
processedback to summary
pack-priv void processed(int delta)

Called after unprocessed buffered bytes have been processed, to release part of the flow control window

API Note

this method is called only when releasing bytes that where buffered after calling canBufferUnprocessedBytes(int).

Parameters
delta:int

the amount of processed bytes to release

releasedback to summary
pack-priv long released(int delta)

Called when it is desired to release unprocessed bytes without processing them, or without triggering the sending of a window update. This method can be called instead of calling processed(int). When this method is called instead of calling processed(int), it should generally be followed by a call to update(int), unless the stream or connection is being closed.

API Note

this method should only be called to release bytes that have been buffered after calling canBufferUnprocessedBytes(int).

Parameters
delta:int

the amount of bytes to release from the window

Returns:long

the amount of remaining unprocessed bytes

sendWindowUpdateback to summary
pack-priv void sendWindowUpdate(int delta)
updateback to summary
pack-priv void update(int delta)

This method is called to update the flow control window, and possibly send a window update

API Note

this method can be called directly if a frame is dropped before calling canBufferUnprocessedBytes(int). Otherwise, either processed(int) or released(int) should be called, depending on whether sending a window update is desired or not. It is typically not desired to send an update if the stream or connection is being closed.

Parameters
delta:int

the amount of bytes released from the window.

windowSizeExceededback to summary
protected abstract boolean windowSizeExceeded(long received)

Called when the flow control window size is exceeded This method may return false if flow control is disabled in this endpoint.

Parameters
received:long

the amount of data received, which is greater than windowSize

Returns:boolean

true if the error was reported to the peer and no further window update should be sent.