Skip to content

Commit 703b345

Browse files
c-clearyshipilev
authored andcommitted
8253179: Replace LinkedList Impl in net.http.Http2Connection
Reviewed-by: dfuchs, prappo, chegar, shade
1 parent 3973073 commit 703b345

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
import java.nio.ByteBuffer;
3434
import java.nio.charset.StandardCharsets;
3535
import java.util.Iterator;
36-
import java.util.LinkedList;
3736
import java.util.List;
3837
import java.util.Locale;
3938
import java.util.Map;
4039
import java.util.Set;
4140
import java.util.concurrent.CompletableFuture;
4241
import java.util.ArrayList;
4342
import java.util.Objects;
43+
import java.util.concurrent.ConcurrentMap;
4444
import java.util.concurrent.ConcurrentHashMap;
4545
import java.util.concurrent.ConcurrentLinkedQueue;
4646
import java.util.concurrent.Flow;
@@ -248,7 +248,7 @@ void markPrefaceSent() {
248248
//-------------------------------------
249249
final HttpConnection connection;
250250
private final Http2ClientImpl client2;
251-
private final Map<Integer,Stream<?>> streams = new ConcurrentHashMap<>();
251+
private final ConcurrentMap<Integer,Stream<?>> streams = new ConcurrentHashMap<>();
252252
private int nextstreamid;
253253
private int nextPushStream = 2;
254254
// actual stream ids are not allocated until the Headers frame is ready
@@ -700,8 +700,7 @@ void shutdown(Throwable t) {
700700
Throwable initialCause = this.cause;
701701
if (initialCause == null) this.cause = t;
702702
client2.deleteConnection(this);
703-
List<Stream<?>> c = new LinkedList<>(streams.values());
704-
for (Stream<?> s : c) {
703+
for (Stream<?> s : streams.values()) {
705704
try {
706705
s.connectionClosing(t);
707706
} catch (Throwable e) {

0 commit comments

Comments
 (0)