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 java.lang.Object implements PriorityQueueNode
The remote flow control state for a single stream.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) intactiveCountForTreeCount of nodes rooted at this sub tree withisActive()equal totrue.(package private) IntObjectMap<WeightedFairQueueByteDistributor.State>children(package private) intdependencyTreeDepthprivate byteflags(package private) WeightedFairQueueByteDistributor.Stateparent(package private) longpseudoTimeA pseudo time maintained for immediate children to base theirpseudoTimeToWriteoff of.private PriorityQueue<WeightedFairQueueByteDistributor.State>pseudoTimeQueueprivate intpseudoTimeQueueIndex(package private) longpseudoTimeToWriteAn estimate of when this node should be given the opportunity to write data.private static byteSTATE_IS_ACTIVEprivate static byteSTATE_IS_DISTRIBUTINGprivate static byteSTATE_STREAM_ACTIVATEDprivate intstateOnlyQueueIndex(package private) Http2StreamstreamMaybenullif the stream if the stream is not active.(package private) intstreamableBytes(package private) intstreamId(package private) longtotalQueuedWeights(package private) shortweight-
Fields inherited from interface io.netty.util.internal.PriorityQueueNode
INDEX_NOT_IN_QUEUE
-
-
Constructor Summary
Constructors Constructor Description State(int streamId)State(int streamId, Http2Stream stream, int initialSize)State(Http2Stream stream)State(Http2Stream stream, int initialSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidactiveCountChangeForTree(int increment)(package private) voidclose()private voidinitChildren()private voidinitChildrenIfEmpty()(package private) booleanisActive()(package private) booleanisDescendantOf(WeightedFairQueueByteDistributor.State state)(package private) booleanisDistributing()(package private) voidofferAndInitializePseudoTime(WeightedFairQueueByteDistributor.State state)The concept of pseudoTime can be influenced by priority tree manipulations or if a stream goes from "active" to "non-active".(package private) voidofferPseudoTimeQueue(WeightedFairQueueByteDistributor.State state)(package private) WeightedFairQueueByteDistributor.StatepeekPseudoTimeQueue()(package private) WeightedFairQueueByteDistributor.StatepollPseudoTimeQueue()Must 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.private IntObjectMap<WeightedFairQueueByteDistributor.State>removeAllChildrenExcept(WeightedFairQueueByteDistributor.State stateToRetain)Remove all children with the exception ofstreamToRetain.(package private) voidremoveChild(WeightedFairQueueByteDistributor.State child)Removes the child priority and moves any of its dependencies to being direct dependencies on this node.(package private) voidremovePseudoTimeQueue(WeightedFairQueueByteDistributor.State state)private voidsetActive()(package private) voidsetDistributing()private voidsetParent(WeightedFairQueueByteDistributor.State newParent)(package private) voidsetStreamReservedOrActivated()(package private) voidtakeChild(WeightedFairQueueByteDistributor.State child, boolean exclusive, java.util.List<WeightedFairQueueByteDistributor.ParentChangedEvent> events)(package private) voidtakeChild(java.util.Iterator<IntObjectMap.PrimitiveEntry<WeightedFairQueueByteDistributor.State>> childItr, WeightedFairQueueByteDistributor.State child, boolean exclusive, java.util.List<WeightedFairQueueByteDistributor.ParentChangedEvent> events)Adds a child to this priority.java.lang.StringtoString()private voidtoString(java.lang.StringBuilder sb)private voidunsetActive()(package private) voidunsetDistributing()(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) booleanwasStreamReservedOrActivated()(package private) voidwrite(int numBytes, StreamByteDistributor.Writer writer)
-
-
-
Field Detail
-
STATE_IS_ACTIVE
private static final byte STATE_IS_ACTIVE
- See Also:
- Constant Field Values
-
STATE_IS_DISTRIBUTING
private static final byte STATE_IS_DISTRIBUTING
- See Also:
- Constant Field Values
-
STATE_STREAM_ACTIVATED
private static final byte STATE_STREAM_ACTIVATED
- See Also:
- Constant Field Values
-
stream
Http2Stream stream
Maybenullif the stream if the stream is not active.
-
parent
WeightedFairQueueByteDistributor.State parent
-
children
IntObjectMap<WeightedFairQueueByteDistributor.State> children
-
pseudoTimeQueue
private final PriorityQueue<WeightedFairQueueByteDistributor.State> pseudoTimeQueue
-
streamId
final int streamId
-
streamableBytes
int streamableBytes
-
dependencyTreeDepth
int dependencyTreeDepth
-
activeCountForTree
int activeCountForTree
Count of nodes rooted at this sub tree withisActive()equal totrue.
-
pseudoTimeQueueIndex
private int pseudoTimeQueueIndex
-
stateOnlyQueueIndex
private int stateOnlyQueueIndex
-
pseudoTimeToWrite
long pseudoTimeToWrite
An estimate of when this node should be given the opportunity to write data.
-
pseudoTime
long pseudoTime
A pseudo time maintained for immediate children to base theirpseudoTimeToWriteoff of.
-
totalQueuedWeights
long totalQueuedWeights
-
flags
private byte flags
-
weight
short weight
-
-
Constructor Detail
-
State
State(int streamId)
-
State
State(Http2Stream stream)
-
State
State(Http2Stream stream, int initialSize)
-
State
State(int streamId, Http2Stream stream, int initialSize)
-
-
Method Detail
-
isDescendantOf
boolean isDescendantOf(WeightedFairQueueByteDistributor.State state)
-
takeChild
void takeChild(WeightedFairQueueByteDistributor.State child, boolean exclusive, java.util.List<WeightedFairQueueByteDistributor.ParentChangedEvent> events)
-
takeChild
void takeChild(java.util.Iterator<IntObjectMap.PrimitiveEntry<WeightedFairQueueByteDistributor.State>> childItr, WeightedFairQueueByteDistributor.State child, boolean exclusive, java.util.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
void removeChild(WeightedFairQueueByteDistributor.State child)
Removes the child priority and moves any of its dependencies to being direct dependencies on this node.
-
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
private void setParent(WeightedFairQueueByteDistributor.State newParent)
-
initChildrenIfEmpty
private void initChildrenIfEmpty()
-
initChildren
private void initChildren()
-
write
void write(int numBytes, StreamByteDistributor.Writer writer) throws Http2Exception- 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
void offerAndInitializePseudoTime(WeightedFairQueueByteDistributor.State state)
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
void offerPseudoTimeQueue(WeightedFairQueueByteDistributor.State state)
-
pollPseudoTimeQueue
WeightedFairQueueByteDistributor.State pollPseudoTimeQueue()
Must only be called if the pseudoTimeQueue is non-empty!
-
removePseudoTimeQueue
void removePseudoTimeQueue(WeightedFairQueueByteDistributor.State state)
-
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
public int priorityQueueIndex(DefaultPriorityQueue<?> queue)
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
public void priorityQueueIndex(DefaultPriorityQueue<?> queue, int i)
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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toString
private void toString(java.lang.StringBuilder sb)
-
-