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) intCount of nodes rooted at this sub tree withisActive()equal totrue.(package private) IntObjectMap<WeightedFairQueueByteDistributor.State> (package private) intprivate byte(package private) WeightedFairQueueByteDistributor.State(package private) longA pseudo time maintained for immediate children to base theirpseudoTimeToWriteoff of.private final PriorityQueue<WeightedFairQueueByteDistributor.State> private int(package private) longAn estimate of when this node should be given the opportunity to write data.private static final byteprivate static final byteprivate static final byteprivate int(package private) Http2StreamMaybenullif the stream if the stream is not active.(package private) int(package private) final int(package private) long(package private) shortFields 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) voidactiveCountChangeForTree(int increment) (package private) voidclose()private longprivate voidprivate void(package private) booleanisActive()(package private) boolean(package private) boolean(package private) voidThe 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.StateMust only be called if the pseudoTimeQueue is non-empty!intpriorityQueueIndex(DefaultPriorityQueue<?> queue) Get the last value set byPriorityQueueNode.priorityQueueIndex(DefaultPriorityQueue, int)for the value corresponding toqueue.voidpriorityQueueIndex(DefaultPriorityQueue<?> queue, int i) Used byDefaultPriorityQueueto maintain state for an element in the queue.removeAllChildrenExcept(WeightedFairQueueByteDistributor.State stateToRetain) Remove all children with the exception ofstreamToRetain.(package private) voidRemoves the child priority and moves any of its dependencies to being direct dependencies on this node.(package private) voidprivate void(package private) voidprivate voidsetParent(WeightedFairQueueByteDistributor.State newParent) (package private) void(package private) voidtakeChild(WeightedFairQueueByteDistributor.State child, boolean exclusive, List<WeightedFairQueueByteDistributor.ParentChangedEvent> events) (package private) voidtakeChild(Iterator<IntObjectMap.PrimitiveEntry<WeightedFairQueueByteDistributor.State>> childItr, WeightedFairQueueByteDistributor.State child, boolean exclusive, List<WeightedFairQueueByteDistributor.ParentChangedEvent> events) Adds a child to this priority.toString()private voidprivate void(package private) void(package private) voidupdatePseudoTime(WeightedFairQueueByteDistributor.State parentState, int nsent, long totalQueuedWeights) Assumes the parentstotalQueuedWeightsincludes this node's weight.(package private) voidupdateStreamableBytes(int newStreamableBytes, boolean isActive) (package private) boolean(package private) voidwrite(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 streamMaybenullif 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 theirpseudoTimeToWriteoff 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
streamToRetainif 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 parentstotalQueuedWeightsincludes 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 thepseudoTimeToWriteforstatetopseudoTimeof 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:PriorityQueueNodeGet 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:
priorityQueueIndexin interfacePriorityQueueNode
-
priorityQueueIndex
Description copied from interface:PriorityQueueNodeUsed byDefaultPriorityQueueto maintain state for an element in the queue.Throwing exceptions from this method will result in undefined behavior.
- Specified by:
priorityQueueIndexin interfacePriorityQueueNode- Parameters:
queue- The queue for which the index is being set.i- The index as used byDefaultPriorityQueue.
-
toString
-
toString
-