Merged branch 'jetty-9.4.x' into 'jetty-10.0.x'.

This commit is contained in:
Simone Bordet 2020-05-13 10:30:38 +02:00
commit 7e38ce4832
1 changed files with 7 additions and 2 deletions

View File

@ -21,6 +21,8 @@ package org.eclipse.jetty.http2;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Deque;
import java.util.HashSet;
import java.util.Iterator;
@ -47,7 +49,7 @@ public class HTTP2Flusher extends IteratingCallback implements Dumpable
private final Queue<WindowEntry> windows = new ArrayDeque<>();
private final Deque<Entry> entries = new ArrayDeque<>();
private final Queue<Entry> pendingEntries = new ArrayDeque<>();
private final Set<Entry> processedEntries = new HashSet<>();
private final Collection<Entry> processedEntries = new ArrayList<>();
private final HTTP2Session session;
private final ByteBufferPool.Lease lease;
private Throwable terminated;
@ -192,7 +194,10 @@ public class HTTP2Flusher extends IteratingCallback implements Dumpable
progress = true;
processedEntries.add(entry);
// We use ArrayList contains() + add() instead of HashSet add()
// because that is faster for collections of size up to 250 entries.
if (!processedEntries.contains(entry))
processedEntries.add(entry);
if (entry.getDataBytesRemaining() == 0)
pending.remove();