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 6b64ef1  Improve BlockPoller thread name
6b64ef1 is described below

commit 6b64ef1c99eb870e111d71000ee4291c46e2c1cc
Author: remm <r...@apache.org>
AuthorDate: Fri Apr 19 11:38:03 2019 +0200

    Improve BlockPoller thread name
    
    Associate BlockPoller thread name with its NIO connector for better
    readability.
---
 java/org/apache/tomcat/util/net/NioBlockingSelector.java | 6 ++----
 java/org/apache/tomcat/util/net/NioEndpoint.java         | 2 +-
 java/org/apache/tomcat/util/net/NioSelectorPool.java     | 4 ++--
 webapps/docs/changelog.xml                               | 4 ++++
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/NioBlockingSelector.java 
b/java/org/apache/tomcat/util/net/NioBlockingSelector.java
index 6702557..252bf0e 100644
--- a/java/org/apache/tomcat/util/net/NioBlockingSelector.java
+++ b/java/org/apache/tomcat/util/net/NioBlockingSelector.java
@@ -43,8 +43,6 @@ public class NioBlockingSelector {
     private static final Log log = 
LogFactory.getLog(NioBlockingSelector.class);
     protected static final StringManager sm = 
StringManager.getManager(NioBlockingSelector.class);
 
-    private static final AtomicInteger threadCounter = new AtomicInteger();
-
     private final SynchronizedStack<KeyReference> keyReferenceStack =
             new SynchronizedStack<>();
 
@@ -55,12 +53,12 @@ public class NioBlockingSelector {
 
     }
 
-    public void open(Selector selector) {
+    public void open(String name, Selector selector) {
         sharedSelector = selector;
         poller = new BlockPoller();
         poller.selector = sharedSelector;
         poller.setDaemon(true);
-        poller.setName("NioBlockingSelector.BlockPoller-" + 
threadCounter.incrementAndGet());
+        poller.setName(name + "-BlockPoller");
         poller.start();
     }
 
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 0df2846..5ba1c1a 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -233,7 +233,7 @@ public class NioEndpoint extends 
AbstractJsseEndpoint<NioChannel,SocketChannel>
         // Initialize SSL if needed
         initialiseSsl();
 
-        selectorPool.open();
+        selectorPool.open(getName());
     }
 
     // Separated out to make it easier for folks that extend NioEndpoint to
diff --git a/java/org/apache/tomcat/util/net/NioSelectorPool.java 
b/java/org/apache/tomcat/util/net/NioSelectorPool.java
index ee2f454..0bcdf8d 100644
--- a/java/org/apache/tomcat/util/net/NioSelectorPool.java
+++ b/java/org/apache/tomcat/util/net/NioSelectorPool.java
@@ -112,12 +112,12 @@ public class NioSelectorPool {
         }
     }
 
-    public void open() throws IOException {
+    public void open(String name) throws IOException {
         enabled = true;
         getSharedSelector();
         if (SHARED) {
             blockingSelector = new NioBlockingSelector();
-            blockingSelector.open(getSharedSelector());
+            blockingSelector.open(name, getSharedSelector());
         }
 
     }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 34fcdee..5f5051e 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -113,6 +113,10 @@
         Change default value of <code>pollerThreadCount</code> of NIO
         to <code>1</code>. (remm)
       </fix>
+      <fix>
+        Associate BlockPoller thread name with its NIO connector for better
+        readability. (remm)
+      </fix>
     </changelog>
   </subsection>
 </section>


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

Reply via email to