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

remm 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 2fe2368792 Fix JMX value for keepAliveCount
2fe2368792 is described below

commit 2fe23687926ccb2ba004106d8a978569f522d2c5
Author: remm <r...@apache.org>
AuthorDate: Thu Jun 19 12:32:39 2025 +0200

    Fix JMX value for keepAliveCount
    
    keepAliveCount should mostly reflect the amount of keys in the selector,
    rather than something more complicated.
    Add useVirtualThreads flag value to JMX.
---
 java/org/apache/tomcat/util/net/NioEndpoint.java       | 2 +-
 java/org/apache/tomcat/util/net/mbeans-descriptors.xml | 3 +++
 webapps/docs/changelog.xml                             | 4 ++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 810accbe26..dc211dfd03 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -660,7 +660,7 @@ public class NioEndpoint extends 
AbstractJsseEndpoint<NioChannel,SocketChannel>
         }
 
         public int getKeyCount() {
-            return keyCount;
+            return selector.keys().size();
         }
 
         public Selector getSelector() {
diff --git a/java/org/apache/tomcat/util/net/mbeans-descriptors.xml 
b/java/org/apache/tomcat/util/net/mbeans-descriptors.xml
index 0216cb1442..69e620977f 100644
--- a/java/org/apache/tomcat/util/net/mbeans-descriptors.xml
+++ b/java/org/apache/tomcat/util/net/mbeans-descriptors.xml
@@ -162,6 +162,9 @@
     <attribute   name="useSendfile"
                  type="boolean"/>
 
+    <attribute   name="useVirtualThreads"
+                 type="boolean"/>
+
     <operation       name="addNegotiatedProtocol"
                returnType="void">
       <parameter name="param0"
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 52d1829642..231bc6d0f1 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -129,6 +129,10 @@
         request multiple times. Based on pull request <pr>868</pr> by
         qingdaoheze. (markt)
       </fix>
+      <fix>
+        Fix JMX value for <code>keepAliveCount</code> on the endpoint. Also add
+        the value of <code>useVirtualThreads</code> in JMX. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


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

Reply via email to