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

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


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

commit 4db92d45e445cb8b35869f42d8638419b2d71c93
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 e653611498..0a8aa8c5d2 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -32,6 +32,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;
 
@@ -1331,16 +1332,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