I manage a J2EE application which is deployed on JBoss 3.2.1. As part of my service to my client I want to provide reports which show the number of active sessions. I have
The JBoss JMX Console already has a integrated session counter in host=localhost,path=/YOUR_PROJECT,type=Manager
By the way, you should use AtomicInteger or synchronize to take care of concurrency problems.