@Test public void samePriorityShouldDistributeBasedOnData() throws Http2Exception { setPriority(STREAM_A, 0, DEFAULT_PRIORITY_WEIGHT, false); setPriority(STREAM_B, 0, DEFAULT_PRIORITY_WEIGHT, false); setPriority(STREAM_C, 0, DEFAULT_PRIORITY_WEIGHT, false); setPriority(STREAM_D, 0, DEFAULT_PRIORITY_WEIGHT, false); initState(STREAM_A, 400, true); initState(STREAM_B, 500, true); initState(STREAM_C, 0, true); initState(STREAM_D, 700, true); distributor.allocationQuantum(1); assertTrue(write(999)); assertEquals(333, captureWrites(STREAM_A)); assertEquals(333, captureWrites(STREAM_B)); verifyWrite(times(1), STREAM_C, 0); assertEquals(333, captureWrites(STREAM_D)); }
public void allocationQuantum(int allocationQuantum) { if (allocationQuantum <= 0) { throw new IllegalArgumentException("allocationQuantum must be > 0"); } this.allocationQuantum = allocationQuantum; }
WeightedFairQueueByteDistributor implements StreamByteDistributor { public void allocationQuantum(int allocationQuantum) { if (allocationQuantum <= 0) { throw new IllegalArgumentException("allocationQuantum must be > 0"); } this.allocationQuantum = allocationQuantum; } }
WeightedFairQueueByteDistributor implements StreamByteDistributor { public void allocationQuantum(int allocationQuantum) { if (allocationQuantum <= 0) { throw new IllegalArgumentException("allocationQuantum must be > 0"); } this.allocationQuantum = allocationQuantum; } WeightedFairQueueByteDistributor(Http2Connection connection);  WeightedFairQueueByteDistributor(Http2Connection connection, int maxStateOnlySize); }
WeightedFairQueueByteDistributor implements StreamByteDistributor { public void allocationQuantum(int allocationQuantum) { if (allocationQuantum <= 0) { throw new IllegalArgumentException("allocationQuantum must be > 0"); } this.allocationQuantum = allocationQuantum; } WeightedFairQueueByteDistributor(Http2Connection connection);  WeightedFairQueueByteDistributor(Http2Connection connection, int maxStateOnlySize); @Override void updateStreamableBytes(StreamState state); @Override void updateDependencyTree(int childStreamId, int parentStreamId, short weight, boolean exclusive); @Override boolean distribute(int maxBytes, Writer writer); void allocationQuantum(int allocationQuantum); }
WeightedFairQueueByteDistributor implements StreamByteDistributor { public void allocationQuantum(int allocationQuantum) { if (allocationQuantum <= 0) { throw new IllegalArgumentException("allocationQuantum must be > 0"); } this.allocationQuantum = allocationQuantum; } WeightedFairQueueByteDistributor(Http2Connection connection);  WeightedFairQueueByteDistributor(Http2Connection connection, int maxStateOnlySize); @Override void updateStreamableBytes(StreamState state); @Override void updateDependencyTree(int childStreamId, int parentStreamId, short weight, boolean exclusive); @Override boolean distribute(int maxBytes, Writer writer); void allocationQuantum(int allocationQuantum);  }