private final class WeightedFairQueueByteDistributor.State extends java.lang.Object implements PriorityQueueNode
Modifier and Type | Field and Description |
---|---|
(package private) int |
activeCountForTree
Count of nodes rooted at this sub tree with
isActive() equal to true . |
(package private) IntObjectMap<WeightedFairQueueByteDistributor.State> |
children |
(package private) int |
dependencyTreeDepth |
private byte |
flags |
(package private) WeightedFairQueueByteDistributor.State |
parent |
(package private) long |
pseudoTime
A pseudo time maintained for immediate children to base their
pseudoTimeToWrite off of. |
private PriorityQueue<WeightedFairQueueByteDistributor.State> |
pseudoTimeQueue |
private int |
pseudoTimeQueueIndex |
(package private) long |
pseudoTimeToWrite
An estimate of when this node should be given the opportunity to write data.
|
private static byte |
STATE_IS_ACTIVE |
private static byte |
STATE_IS_DISTRIBUTING |
private static byte |
STATE_STREAM_ACTIVATED |
private int |
stateOnlyQueueIndex |
(package private) Http2Stream |
stream
Maybe
null if the stream if the stream is not active. |
(package private) int |
streamableBytes |
(package private) int |
streamId |
(package private) long |
totalQueuedWeights |
(package private) short |
weight |
INDEX_NOT_IN_QUEUE
Constructor and Description |
---|
State(Http2Stream stream) |
State(Http2Stream stream,
int initialSize) |
State(int streamId) |
State(int streamId,
Http2Stream stream,
int initialSize) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
activeCountChangeForTree(int increment) |
(package private) void |
close() |
private void |
initChildren() |
private void |
initChildrenIfEmpty() |
(package private) boolean |
isActive() |
(package private) boolean |
isDescendantOf(WeightedFairQueueByteDistributor.State state) |
(package private) boolean |
isDistributing() |
(package private) 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".
|
(package private) void |
offerPseudoTimeQueue(WeightedFairQueueByteDistributor.State state) |
(package private) WeightedFairQueueByteDistributor.State |
peekPseudoTimeQueue() |
(package private) WeightedFairQueueByteDistributor.State |
pollPseudoTimeQueue()
Must only be called if the pseudoTimeQueue is non-empty!
|
int |
priorityQueueIndex(DefaultPriorityQueue<?> queue)
Get the last value set by
PriorityQueueNode.priorityQueueIndex(DefaultPriorityQueue, int) for the value corresponding to
queue . |
void |
priorityQueueIndex(DefaultPriorityQueue<?> queue,
int i)
Used by
DefaultPriorityQueue to maintain state for an element in the queue. |
private IntObjectMap<WeightedFairQueueByteDistributor.State> |
removeAllChildrenExcept(WeightedFairQueueByteDistributor.State stateToRetain)
Remove all children with the exception of
streamToRetain . |
(package private) void |
removeChild(WeightedFairQueueByteDistributor.State child)
Removes the child priority and moves any of its dependencies to being direct dependencies on this node.
|
(package private) void |
removePseudoTimeQueue(WeightedFairQueueByteDistributor.State state) |
private void |
setActive() |
(package private) void |
setDistributing() |
private void |
setParent(WeightedFairQueueByteDistributor.State newParent) |
(package private) void |
setStreamReservedOrActivated() |
(package private) 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.
|
(package private) void |
takeChild(WeightedFairQueueByteDistributor.State child,
boolean exclusive,
java.util.List<WeightedFairQueueByteDistributor.ParentChangedEvent> events) |
java.lang.String |
toString() |
private void |
toString(java.lang.StringBuilder sb) |
private void |
unsetActive() |
(package private) void |
unsetDistributing() |
(package private) void |
updatePseudoTime(WeightedFairQueueByteDistributor.State parentState,
int nsent,
long totalQueuedWeights)
Assumes the parents
totalQueuedWeights includes this node's weight. |
(package private) void |
updateStreamableBytes(int newStreamableBytes,
boolean isActive) |
(package private) boolean |
wasStreamReservedOrActivated() |
(package private) void |
write(int numBytes,
StreamByteDistributor.Writer writer) |
private static final byte STATE_IS_ACTIVE
private static final byte STATE_IS_DISTRIBUTING
private static final byte STATE_STREAM_ACTIVATED
Http2Stream stream
null
if the stream if the stream is not active.WeightedFairQueueByteDistributor.State parent
IntObjectMap<WeightedFairQueueByteDistributor.State> children
private final PriorityQueue<WeightedFairQueueByteDistributor.State> pseudoTimeQueue
final int streamId
int streamableBytes
int dependencyTreeDepth
int activeCountForTree
isActive()
equal to true
.private int pseudoTimeQueueIndex
private int stateOnlyQueueIndex
long pseudoTimeToWrite
long pseudoTime
pseudoTimeToWrite
off of.long totalQueuedWeights
private byte flags
short weight
State(int streamId)
State(Http2Stream stream)
State(Http2Stream stream, int initialSize)
State(int streamId, Http2Stream stream, int initialSize)
boolean isDescendantOf(WeightedFairQueueByteDistributor.State state)
void takeChild(WeightedFairQueueByteDistributor.State child, boolean exclusive, java.util.List<WeightedFairQueueByteDistributor.ParentChangedEvent> events)
void takeChild(java.util.Iterator<IntObjectMap.PrimitiveEntry<WeightedFairQueueByteDistributor.State>> childItr, WeightedFairQueueByteDistributor.State child, boolean exclusive, java.util.List<WeightedFairQueueByteDistributor.ParentChangedEvent> events)
void removeChild(WeightedFairQueueByteDistributor.State child)
private IntObjectMap<WeightedFairQueueByteDistributor.State> removeAllChildrenExcept(WeightedFairQueueByteDistributor.State stateToRetain)
streamToRetain
.
This method is intended to be used to support an exclusive priority dependency operation.streamToRetain
if present.private void setParent(WeightedFairQueueByteDistributor.State newParent)
private void initChildrenIfEmpty()
private void initChildren()
void write(int numBytes, StreamByteDistributor.Writer writer) throws Http2Exception
Http2Exception
void activeCountChangeForTree(int increment)
void updateStreamableBytes(int newStreamableBytes, boolean isActive)
void updatePseudoTime(WeightedFairQueueByteDistributor.State parentState, int nsent, long totalQueuedWeights)
totalQueuedWeights
includes this node's weight.void offerAndInitializePseudoTime(WeightedFairQueueByteDistributor.State state)
pseudoTimeToWrite
for
state
to pseudoTime
of this node and then calls #offerPseudoTimeQueue(State)
.void offerPseudoTimeQueue(WeightedFairQueueByteDistributor.State state)
WeightedFairQueueByteDistributor.State pollPseudoTimeQueue()
void removePseudoTimeQueue(WeightedFairQueueByteDistributor.State state)
WeightedFairQueueByteDistributor.State peekPseudoTimeQueue()
void close()
boolean wasStreamReservedOrActivated()
void setStreamReservedOrActivated()
boolean isActive()
private void setActive()
private void unsetActive()
boolean isDistributing()
void setDistributing()
void unsetDistributing()
public int priorityQueueIndex(DefaultPriorityQueue<?> queue)
PriorityQueueNode
PriorityQueueNode.priorityQueueIndex(DefaultPriorityQueue, int)
for the value corresponding to
queue
.
Throwing exceptions from this method will result in undefined behavior.
priorityQueueIndex
in interface PriorityQueueNode
public void priorityQueueIndex(DefaultPriorityQueue<?> queue, int i)
PriorityQueueNode
DefaultPriorityQueue
to maintain state for an element in the queue.
Throwing exceptions from this method will result in undefined behavior.
priorityQueueIndex
in interface PriorityQueueNode
queue
- The queue for which the index is being set.i
- The index as used by DefaultPriorityQueue
.public java.lang.String toString()
toString
in class java.lang.Object
private void toString(java.lang.StringBuilder sb)