Package io.netty.handler.codec.http2
Class WeightedFairQueueByteDistributor.State
java.lang.Object
io.netty.handler.codec.http2.WeightedFairQueueByteDistributor.State
- All Implemented Interfaces:
PriorityQueueNode
- Enclosing class:
WeightedFairQueueByteDistributor
private final class WeightedFairQueueByteDistributor.State
extends Object
implements PriorityQueueNode
The remote flow control state for a single stream.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
Count of nodes rooted at this sub tree withisActive()
equal totrue
.(package private) IntObjectMap
<WeightedFairQueueByteDistributor.State> (package private) int
private byte
(package private) WeightedFairQueueByteDistributor.State
(package private) long
A pseudo time maintained for immediate children to base theirpseudoTimeToWrite
off of.private final PriorityQueue
<WeightedFairQueueByteDistributor.State> private int
(package private) long
An estimate of when this node should be given the opportunity to write data.private static final byte
private static final byte
private static final byte
private int
(package private) Http2Stream
Maybenull
if the stream if the stream is not active.(package private) int
(package private) final int
(package private) long
(package private) short
Fields inherited from interface io.netty.util.internal.PriorityQueueNode
INDEX_NOT_IN_QUEUE
-
Constructor Summary
ConstructorsConstructorDescriptionState
(int streamId) State
(int streamId, Http2Stream stream, int initialSize) State
(Http2Stream stream) State
(Http2Stream stream, int initialSize) -
Method Summary
Modifier and TypeMethodDescription(package private) void
activeCountChangeForTree
(int increment) (package private) void
close()
private long
private void
private void
(package private) boolean
isActive()
(package private) boolean
(package private) boolean
(package private) void
The concept of pseudoTime can be influenced by priority tree manipulations or if a stream goes from "active" to "non-active".(package private) void
(package private) WeightedFairQueueByteDistributor.State
(package private) WeightedFairQueueByteDistributor.State
Must only be called if the pseudoTimeQueue is non-empty!int
priorityQueueIndex
(DefaultPriorityQueue<?> queue) Get the last value set byPriorityQueueNode.priorityQueueIndex(DefaultPriorityQueue, int)
for the value corresponding toqueue
.void
priorityQueueIndex
(DefaultPriorityQueue<?> queue, int i) Used byDefaultPriorityQueue
to maintain state for an element in the queue.removeAllChildrenExcept
(WeightedFairQueueByteDistributor.State stateToRetain) Remove all children with the exception ofstreamToRetain
.(package private) void
Removes the child priority and moves any of its dependencies to being direct dependencies on this node.(package private) void
private void
(package private) void
private void
setParent
(WeightedFairQueueByteDistributor.State newParent) (package private) void
(package private) void
takeChild
(WeightedFairQueueByteDistributor.State child, boolean exclusive, List<WeightedFairQueueByteDistributor.ParentChangedEvent> events) (package private) void
takeChild
(Iterator<IntObjectMap.PrimitiveEntry<WeightedFairQueueByteDistributor.State>> childItr, WeightedFairQueueByteDistributor.State child, boolean exclusive, List<WeightedFairQueueByteDistributor.ParentChangedEvent> events) Adds a child to this priority.toString()
private void
private void
(package private) void
(package private) void
updatePseudoTime
(WeightedFairQueueByteDistributor.State parentState, int nsent, long totalQueuedWeights) Assumes the parentstotalQueuedWeights
includes this node's weight.(package private) void
updateStreamableBytes
(int newStreamableBytes, boolean isActive) (package private) boolean
(package private) void
write
(int numBytes, StreamByteDistributor.Writer writer)
-
Field Details
-
STATE_IS_ACTIVE
private static final byte STATE_IS_ACTIVE- See Also:
-
STATE_IS_DISTRIBUTING
private static final byte STATE_IS_DISTRIBUTING- See Also:
-
STATE_STREAM_ACTIVATED
private static final byte STATE_STREAM_ACTIVATED- See Also:
-
stream
Http2Stream streamMaybenull
if the stream if the stream is not active. -
parent
-
children
-
pseudoTimeQueue
-
streamId
final int streamId -
streamableBytes
int streamableBytes -
dependencyTreeDepth
int dependencyTreeDepth -
activeCountForTree
int activeCountForTreeCount of nodes rooted at this sub tree withisActive()
equal totrue
. -
pseudoTimeQueueIndex
private int pseudoTimeQueueIndex -
stateOnlyQueueIndex
private int stateOnlyQueueIndex -
pseudoTimeToWrite
long pseudoTimeToWriteAn estimate of when this node should be given the opportunity to write data. -
pseudoTime
long pseudoTimeA pseudo time maintained for immediate children to base theirpseudoTimeToWrite
off of. -
totalQueuedWeights
long totalQueuedWeights -
flags
private byte flags -
weight
short weight
-
-
Constructor Details
-
State
State(int streamId) -
State
State(Http2Stream stream) -
State
State(Http2Stream stream, int initialSize) -
State
State(int streamId, Http2Stream stream, int initialSize)
-
-
Method Details
-
isDescendantOf
-
takeChild
void takeChild(WeightedFairQueueByteDistributor.State child, boolean exclusive, List<WeightedFairQueueByteDistributor.ParentChangedEvent> events) -
takeChild
void takeChild(Iterator<IntObjectMap.PrimitiveEntry<WeightedFairQueueByteDistributor.State>> childItr, WeightedFairQueueByteDistributor.State child, boolean exclusive, List<WeightedFairQueueByteDistributor.ParentChangedEvent> events) Adds a child to this priority. If exclusive is set, any children of this node are moved to being dependent on the child. -
removeChild
Removes the child priority and moves any of its dependencies to being direct dependencies on this node. -
getTotalWeight
private long getTotalWeight() -
removeAllChildrenExcept
private IntObjectMap<WeightedFairQueueByteDistributor.State> removeAllChildrenExcept(WeightedFairQueueByteDistributor.State stateToRetain) Remove all children with the exception ofstreamToRetain
. This method is intended to be used to support an exclusive priority dependency operation.- Returns:
- The map of children prior to this operation, excluding
streamToRetain
if present.
-
setParent
-
initChildrenIfEmpty
private void initChildrenIfEmpty() -
initChildren
private void initChildren() -
write
- Throws:
Http2Exception
-
activeCountChangeForTree
void activeCountChangeForTree(int increment) -
updateStreamableBytes
void updateStreamableBytes(int newStreamableBytes, boolean isActive) -
updatePseudoTime
void updatePseudoTime(WeightedFairQueueByteDistributor.State parentState, int nsent, long totalQueuedWeights) Assumes the parentstotalQueuedWeights
includes this node's weight. -
offerAndInitializePseudoTime
The concept of pseudoTime can be influenced by priority tree manipulations or if a stream goes from "active" to "non-active". This method accounts for that by initializing thepseudoTimeToWrite
forstate
topseudoTime
of this node and then callsofferPseudoTimeQueue(State)
. -
offerPseudoTimeQueue
-
pollPseudoTimeQueue
WeightedFairQueueByteDistributor.State pollPseudoTimeQueue()Must only be called if the pseudoTimeQueue is non-empty! -
removePseudoTimeQueue
-
peekPseudoTimeQueue
WeightedFairQueueByteDistributor.State peekPseudoTimeQueue() -
close
void close() -
wasStreamReservedOrActivated
boolean wasStreamReservedOrActivated() -
setStreamReservedOrActivated
void setStreamReservedOrActivated() -
isActive
boolean isActive() -
setActive
private void setActive() -
unsetActive
private void unsetActive() -
isDistributing
boolean isDistributing() -
setDistributing
void setDistributing() -
unsetDistributing
void unsetDistributing() -
priorityQueueIndex
Description copied from interface:PriorityQueueNode
Get the last value set byPriorityQueueNode.priorityQueueIndex(DefaultPriorityQueue, int)
for the value corresponding toqueue
.Throwing exceptions from this method will result in undefined behavior.
- Specified by:
priorityQueueIndex
in interfacePriorityQueueNode
-
priorityQueueIndex
Description copied from interface:PriorityQueueNode
Used byDefaultPriorityQueue
to maintain state for an element in the queue.Throwing exceptions from this method will result in undefined behavior.
- Specified by:
priorityQueueIndex
in interfacePriorityQueueNode
- Parameters:
queue
- The queue for which the index is being set.i
- The index as used byDefaultPriorityQueue
.
-
toString
-
toString
-