Top Description Fields Constructors Methods
org.apache.coyote.http2

pack-priv Class WindowAllocationManager

extends Object
Class Inheritance
Imports
java.util.concurrent.TimeUnit, org.apache.coyote.ActionCode, .Response, org.apache.juli.logging.Log, .LogFactory, org.apache.tomcat.util.res.StringManager

Tracks whether the stream is waiting for an allocation to the stream flow control window, to the connection flow control window or not waiting for an allocation and only issues allocation notifications when the stream is known to be waiting for the notification.

It is possible for a stream to be waiting for a connection allocation when a stream allocation is made. Therefore this class tracks the type of allocation that the stream is waiting for to ensure that notifications are correctly triggered.

With the implementation at the time of writing, it is not possible for a stream to receive an unexpected connection notification as these are only issues to streams in the backlog and a stream must be waiting for a connection allocation in order to be placed on the backlog. However, as a precaution, this class protects against unexpected connection notifications.

It is important for asynchronous processing not to notify unless a notification is expected else a dispatch will be performed unnecessarily which may lead to unexpected results.

A previous implementation used separate locks for the stream and connection notifications. However, correct handling of allocation waiting requires holding the stream lock when making the decision to wait. Therefore both allocations need to wait on the Stream.

Field Summary

Modifier and TypeField and Description
private static final int
private static final Log
private static final int
private static final StringManager
private static final int
private final Stream
private int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private boolean
isWaitingFor(int waitTarget)

pack-priv boolean
pack-priv boolean
private void
notify(int notifyTarget)

pack-priv void
pack-priv void
pack-priv void
private void
waitFor(int waitTarget, final long timeout)

pack-priv void
waitForConnection(long timeout)

pack-priv void
private void
waitForNonBlocking(int waitTarget)

pack-priv void
waitForStream(long timeout)

pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CONNECTIONback to summary
private static final int CONNECTION
logback to summary
private static final Log log
NONEback to summary
private static final int NONE
smback to summary
private static final StringManager sm
STREAMback to summary
private static final int STREAM
streamback to summary
private final Stream stream
waitingForback to summary
private int waitingFor

Constructor Detail

WindowAllocationManagerback to summary
pack-priv WindowAllocationManager(Stream stream)

Method Detail

isWaitingForback to summary
private boolean isWaitingFor(int waitTarget)
isWaitingForConnectionback to summary
pack-priv boolean isWaitingForConnection()
isWaitingForStreamback to summary
pack-priv boolean isWaitingForStream()
notifyback to summary
private void notify(int notifyTarget)
notifyAnyback to summary
pack-priv void notifyAny()
notifyConnectionback to summary
pack-priv void notifyConnection()
notifyStreamback to summary
pack-priv void notifyStream()
waitForback to summary
private void waitFor(int waitTarget, final long timeout) throws InterruptedException
waitForConnectionback to summary
pack-priv void waitForConnection(long timeout) throws InterruptedException
waitForConnectionNonBlockingback to summary
pack-priv void waitForConnectionNonBlocking()
waitForNonBlockingback to summary
private void waitForNonBlocking(int waitTarget)
waitForStreamback to summary
pack-priv void waitForStream(long timeout) throws InterruptedException
waitForStreamNonBlockingback to summary
pack-priv void waitForStreamNonBlocking()