This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new b1a239056a Update comment
b1a239056a is described below

commit b1a239056a9643f3e8fd502909c66385678b8d51
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jul 26 17:19:22 2023 +0100

    Update comment
---
 java/org/apache/coyote/http2/Http2UpgradeHandler.java | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index b32b9dbbfb..c6c219edf1 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -33,6 +33,7 @@ import java.util.concurrent.ConcurrentSkipListSet;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.locks.Lock;
 
 import javax.servlet.http.WebConnection;
 
@@ -1326,16 +1327,18 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 
         Stream pushStream;
 
-        // Synchronized since PUSH_PROMISE frames have to be sent in order. 
Once
-        // the stream has been created we need to ensure that the PUSH_PROMISE
-        // is sent before the next stream is created for a PUSH_PROMISE.
-        socketWrapper.getLock().lock();
+        /*
+         * Uses SocketWrapper lock since PUSH_PROMISE frames have to be sent 
in order. Once the stream has been created
+         * we need to ensure that the PUSH_PROMISE is sent before the next 
stream is created for a PUSH_PROMISE.
+         */
+        Lock lock = socketWrapper.getLock();
+        lock.lock();
         try {
             pushStream = createLocalStream(request);
             writeHeaders(associatedStream, pushStream.getIdAsInt(), 
request.getMimeHeaders(), false,
                     Constants.DEFAULT_HEADERS_FRAME_SIZE);
         } finally {
-            socketWrapper.getLock().unlock();
+            lock.unlock();
         }
 
         pushStream.sentPushPromise();


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to