使用Java获取Tomcat中的活动会话列表 [英] Getting a list of active sessions in Tomcat using Java

查看:143
本文介绍了使用Java获取Tomcat中的活动会话列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Java开发一个项目,我希望在Tomcat中计算所有活动会话。基于此我想看看有多少用户是活跃的并且实际使用该应用程序。

I am developing a project in Java in which I want the count of all active sessions in Tomcat. Based on that I want to see how much of those users are active and actually using the application.

推荐答案

你应该使用JMX( Java Managemnet eXtension)并查询以下内容

You should use JMX (Java Managemnet eXtension) and query the following

jmxObjectName:    Catalina:host=localhost,path=/,type=Manager
jmxAttributeName: activeSessions

您可以使用jconsole访问此数据。要运行jmx,请参阅 http://tomcat.apache.org/tomcat-6.0- doc / monitoring.html

You can use jconsole to access this data. To get jmx running see http://tomcat.apache.org/tomcat-6.0-doc/monitoring.html

使用JMX有很多好处,因为你也可以获得大量其他数据。你可以将它放在一个munin插件中,让munin监控它并绘制漂亮的图形来查看。

You have lot of advantages using JMX as you get lots of other data, too. You can put it in a munin plugin and let munin monitor it and draw nice graphs to look at.

这篇关于使用Java获取Tomcat中的活动会话列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆