问题描述
我正在尝试使用JMX API获取Web应用程序的活动会话计数.
I'm trying to use JMX API to get active session counts for a web application.
- 是否可以使用JMX API来获取此类信息?
- 如果是,那么它的可靠性如何?
- 任何有关如何完成此操作的示例代码?
我一直在阅读JMX教程和文档,但它们为我提供了有关该技术的概述.我只是无法确定我需要什么.
I've been reading JMX tutorial and documentation, but they are giving me the overview of what the technology is. I just can't pinpoint to what I need, yet.
推荐答案
将应用服务器配置为公开JMX端口后,就可以使用JConsole或JVisualVM之类的方法来完成此任务.您没有提及正在使用的应用服务器,但在Tomcat中进行了描述: http://tomcat.apache.org/tomcat-5.5-doc/monitoring.html .与JConsole连接后,Tomcat会公开一个具有会话信息的MBean,但它又取决于您使用的容器.
You can accomplish this by using something like JConsole or JVisualVM once you configure your app server to expose a JMX port. You don't mention which app server you're using but for Tomcat, it's described here: http://tomcat.apache.org/tomcat-5.5-doc/monitoring.html. Once you connect with JConsole, Tomcat exposes an MBean which has session information but again it depends which container you use.
这篇关于使用JMX(Java管理扩展)API获取活动会话计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!