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

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


The following commit(s) were added to refs/heads/main by this push:
     new ee56e34a3f Fix JMX value for keepAliveCount
ee56e34a3f is described below

commit ee56e34a3fb62cf42223222f21786dc1f55bee85
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 a1e3979698..617104603d 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 a9f2a1dd82..d24b3acaa9 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -202,6 +202,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