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

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 8eced7a  Remove useless lock
8eced7a is described below

commit 8eced7a0a195bfb0f886c7f322369d50c09ad425
Author: remm <r...@apache.org>
AuthorDate: Tue Dec 17 10:36:11 2019 +0100

    Remove useless lock
    
    This will not cause any problem, but looking at the traces in 64007 the
    extra locking is not necessary since it is guarded by the atomic boolean
    and nothing else syncs on U.
---
 java/org/apache/tomcat/util/net/AprEndpoint.java  |  8 +++-----
 java/org/apache/tomcat/util/net/Nio2Endpoint.java | 14 ++++++--------
 java/org/apache/tomcat/util/net/NioEndpoint.java  | 14 ++++++--------
 3 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java 
b/java/org/apache/tomcat/util/net/AprEndpoint.java
index ebfd51b..b8b71e3 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -2240,12 +2240,10 @@ public class AprEndpoint extends 
AbstractEndpoint<Long,Long> implements SNICallB
             getEndpoint().connections.remove(getSocket());
             socketBufferHandler = SocketBufferHandler.EMPTY;
             nonBlockingWriteBuffer.clear();
-            synchronized (closed) {
-                if (sslOutputBuffer != null) {
-                    ByteBufferUtils.cleanDirectBuffer(sslOutputBuffer);
-                }
-                ((AprEndpoint) 
getEndpoint()).getPoller().close(getSocket().longValue());
+            if (sslOutputBuffer != null) {
+                ByteBufferUtils.cleanDirectBuffer(sslOutputBuffer);
             }
+            ((AprEndpoint) 
getEndpoint()).getPoller().close(getSocket().longValue());
         }
 
 
diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java 
b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index ff5303b..adafdad 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -926,14 +926,12 @@ public class Nio2Endpoint extends 
AbstractJsseEndpoint<Nio2Channel,AsynchronousS
             }
             try {
                 getEndpoint().connections.remove(getSocket().getIOChannel());
-                synchronized (getSocket()) {
-                    if (getSocket().isOpen()) {
-                        getSocket().close(true);
-                    }
-                    if (getEndpoint().running && !getEndpoint().paused) {
-                        if (nioChannels == null || 
!nioChannels.push(getSocket())) {
-                            getSocket().free();
-                        }
+                if (getSocket().isOpen()) {
+                    getSocket().close(true);
+                }
+                if (getEndpoint().running && !getEndpoint().paused) {
+                    if (nioChannels == null || !nioChannels.push(getSocket())) 
{
+                        getSocket().free();
                     }
                 }
             } catch (Throwable e) {
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 1352ef5..67f02a7 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1187,14 +1187,12 @@ public class NioEndpoint extends 
AbstractJsseEndpoint<NioChannel,SocketChannel>
             }
             try {
                 getEndpoint().connections.remove(getSocket().getIOChannel());
-                synchronized (getSocket()) {
-                    if (getSocket().isOpen()) {
-                        getSocket().close(true);
-                    }
-                    if (getEndpoint().running && !getEndpoint().paused) {
-                        if (nioChannels == null || 
!nioChannels.push(getSocket())) {
-                            getSocket().free();
-                        }
+                if (getSocket().isOpen()) {
+                    getSocket().close(true);
+                }
+                if (getEndpoint().running && !getEndpoint().paused) {
+                    if (nioChannels == null || !nioChannels.push(getSocket())) 
{
+                        getSocket().free();
                     }
                 }
             } catch (Throwable e) {


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

Reply via email to