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

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


The following commit(s) were added to refs/heads/11.0.x by this push:
     new 2fff6a8c7b Fix JMX value for keepAliveCount
2fff6a8c7b is described below

commit 2fff6a8c7be2d2028d8dbd9c1c3fd3da6c2a78ed
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 f6ef6a5b30..62bcae1a30 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -634,7 +634,7 @@ public class NioEndpoint extends 
AbstractNetworkChannelEndpoint<NioChannel,Socke
         }
 
         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 c99a31d88d..e5bc356b96 100644
--- a/java/org/apache/tomcat/util/net/mbeans-descriptors.xml
+++ b/java/org/apache/tomcat/util/net/mbeans-descriptors.xml
@@ -147,6 +147,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 6641dcd077..dabb046baf 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -133,6 +133,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