Is it a possible to invalidate an individual session in JBoss through JMX?

不想你离开。 提交于 2019-11-30 17:25:04

问题


We are tracking down some memory issues in our application and we have visibility into the size of our sessions where the problem seems to be. It is only affecting certain sessions where they seem to balloon out of control and we'd like to have the ability to invalidate those sessions more-or-less 'by hand' to reclaim that memory . Is there a way to do this through JMX? We are using JBoss 4.5.2 .

Thanks in advance.


回答1:


The answer is yes, you can.

--this gets the web module MBeans loaded in JBoss--

/opt/lib/jboss-4.2.3.GA/bin/twiddle.sh -s <--ServerIP-->:1099 query 'jboss.web:*' | grep "type=Manager"

--Once you have that you can get the active sessions from that MBean--

/opt/lib/jboss-4.2.3.GA/bin/twiddle.sh -s 172.16.0.216:1099 invoke "<--MBean-->" listSessionIds

--And finally, once you have that list, you can pick out the session of interest and expire it--

/opt/lib/jboss-4.2.3.GA/bin/twiddle.sh -s <--ServerIP-->:1099 invoke "<--MBean-->" expireSession <--SessionID-->

You would replace <--ServerIP--> with the ip the server is bound on...it need not be local. This can be run remotely as long as you have access to port 1099.

<--MBean--> would be replaced with one of the results of the first query.

<--SessionID--> would be replaced with one of the session ids from the second command.

Also you would replace /opt/lib/jboss-4.2.3.GA/bin/twiddle.sh with the location of twiddle on your machine. It is included in JBoss.




回答2:


Thanks Ichorus. Your solution helped me with at least some way to see all the active sessions on the server at any given time.

Btw...Here are couple of things needed before running twiddle.sh Make sure JAVA_HOME and JBOSS_HOME are set in the environment And Make Sure JBOSS_CLASSPATH is either not set or has all the libs given in twiddle.sh.i.e {JBOSS_HOME}\client\jbossall-client.jar;{JBOSS_HOME}\client\getopt.jar;{JBOSS_HOME}\client\log4j.jar; {JBOSS_HOME}\lib\jboss-jmx.jar

Other wise you would run into ClassNotFound exceptions

Sudheer



来源:https://stackoverflow.com/questions/744021/is-it-a-possible-to-invalidate-an-individual-session-in-jboss-through-jmx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!