You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/10/10 10:19:11 UTC

[tomcat] 02/02: Add debug logging of read/write interest registration

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

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

commit 7afcf7a695cca5c8d0c05c28059c905f467b0d92
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Oct 9 21:51:24 2019 +0100

    Add debug logging of read/write interest registration
---
 java/org/apache/tomcat/util/net/AprEndpoint.java        | 6 ++++++
 java/org/apache/tomcat/util/net/LocalStrings.properties | 2 ++
 java/org/apache/tomcat/util/net/Nio2Endpoint.java       | 6 ++++++
 java/org/apache/tomcat/util/net/NioEndpoint.java        | 6 ++++++
 4 files changed, 20 insertions(+)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 3f9cb3b..8c0d484 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -2410,6 +2410,9 @@ public class AprEndpoint extends AbstractEndpoint<Long,Long> implements SNICallB
                 if (isClosed()) {
                     return;
                 }
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("endpoint.debug.registerRead", this));
+                }
                 Poller p = ((AprEndpoint) getEndpoint()).getPoller();
                 if (p != null) {
                     p.add(getSocket().longValue(), getReadTimeout(), Poll.APR_POLLIN);
@@ -2425,6 +2428,9 @@ public class AprEndpoint extends AbstractEndpoint<Long,Long> implements SNICallB
                 if (isClosed()) {
                     return;
                 }
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("endpoint.debug.registerWrite", this));
+                }
                 ((AprEndpoint) getEndpoint()).getPoller().add(
                         getSocket().longValue(), getWriteTimeout(), Poll.APR_POLLOUT);
             }
diff --git a/java/org/apache/tomcat/util/net/LocalStrings.properties b/java/org/apache/tomcat/util/net/LocalStrings.properties
index 3eed259..0fdd2df 100644
--- a/java/org/apache/tomcat/util/net/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/net/LocalStrings.properties
@@ -68,6 +68,8 @@ endpoint.debug.pollerAddDo=Add to poller socket [{0}]
 endpoint.debug.pollerProcess=Processing socket [{0}] for event(s) [{1}]
 endpoint.debug.pollerRemove=Attempting to remove [{0}] from poller
 endpoint.debug.pollerRemoved=Removed [{0}] from poller
+endpoint.debug.registerRead=Registered read interest for [{0}]
+endpoint.debug.registerWrite=Registered write interest for [{0}]
 endpoint.debug.socket=socket [{0}]
 endpoint.debug.socketTimeout=Timing out [{0}]
 endpoint.debug.unlock.fail=Caught exception trying to unlock accept on port [{0}]
diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index 4bb8ba1..e61215b 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -1368,6 +1368,9 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS
                 if (readNotify) {
                     return;
                 }
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("endpoint.debug.registerRead", this));
+                }
                 readInterest = true;
                 if (readPending.tryAcquire()) {
                     // No read pending, so do a read
@@ -1395,6 +1398,9 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS
                 if (writeNotify) {
                     return;
                 }
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("endpoint.debug.registerWrite", this));
+                }
                 writeInterest = true;
                 if (writePending.availablePermits() == 1) {
                     // If no write is pending, notify that writing is possible
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 150bcf5..84b3003 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1277,12 +1277,18 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
 
         @Override
         public void registerReadInterest() {
+            if (log.isDebugEnabled()) {
+                log.debug(sm.getString("endpoint.debug.registerRead", this));
+            }
             getPoller().add(this, SelectionKey.OP_READ);
         }
 
 
         @Override
         public void registerWriteInterest() {
+            if (log.isDebugEnabled()) {
+                log.debug(sm.getString("endpoint.debug.registerWrite", this));
+            }
             getPoller().add(this, SelectionKey.OP_WRITE);
         }
 


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