Skip to content

Commit 25792ff

Browse files
committed
Remove unnecessary lock
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
1 parent ea56d57 commit 25792ff

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

connectors/jdk-connector/src/main/java/org/glassfish/jersey/jdk/connector/internal/DestinationConnectionPool.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2021 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -195,12 +195,11 @@ private void handleIllegalStateTransition(HttpConnection.State oldState, HttpCon
195195
throw new IllegalStateException("Illegal state transition, old state: " + oldState + " new state: " + newState);
196196
}
197197

198-
private synchronized void removeAllPendingWithError(Throwable t) {
199-
for (RequestRecord requestRecord : pendingRequests) {
198+
private void removeAllPendingWithError(Throwable t) {
199+
RequestRecord requestRecord = null;
200+
while ((requestRecord = pendingRequests.poll()) != null) {
200201
requestRecord.completionHandler.failed(t);
201202
}
202-
203-
pendingRequests.clear();
204203
}
205204

206205
private class ConnectionStateListener implements HttpConnection.StateChangeListener {

0 commit comments

Comments
 (0)