You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Daga, Harshit" <ha...@gatech.edu> on 2017/05/23 00:04:19 UTC

Getting list of session for different contexts

Hi,

I am trying to do the following. As part of the tomcat startup I have added a listener. This listener starts a thread and that thread will open a socket connection. I am doing so to record the time taken to access and get the information from the tomcat server. If I use Jmx it is taking slightly more time, thus I am experimenting using direct socket connection.

Now I want to get the list of sessions from different contexts. Kindly, let me know how can I get list of sessions for different contexts?
I guess I can get the list of sessions from StandarManager class but how to get the instant of this class for different contexts?


Thanks & Regards,
Harshit Daga

Re: Getting list of session for different contexts

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Harshit,

On 5/22/17 8:04 PM, Daga, Harshit wrote:
> I am trying to do the following. As part of the tomcat startup I 
> have added a listener. This listener starts a thread and that
> thread will open a socket connection. I am doing so to record the
> time taken to access and get the information from the tomcat
> server. If I use Jmx it is taking slightly more time, thus I am
> experimenting using direct socket connection.

Can you explain this in a little more detail? You want higher
performance, so you are not using HTTP? Or you want higher performance
so you are not using JMX (protocol)?

> Now I want to get the list of sessions from different contexts. 
> Kindly, let me know how can I get list of sessions for different 
> contexts?
> 
> I guess I can get the list of sessions from StandarManager class
> but how to get the instant of this class for different contexts?

You can get it through local JMX if you wish. Fire-up VisualVM, connect
to the instance, and find the name of the SessionManager that you want.
Then, write a small bit of Java code in your TCP connection-handler that
fetches that JMX bean and call the the appropriate method (or fetches
the appropriate property value).

- -chris

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlkkePgACgkQHPApP6U8
pFjCvA//QRpKran2I6EvMpIdvj/NBFCNvnnlvhSeHy8sa1qUf7/mC+TVTpvUXF9A
bWp6hl0hzZwdlV2LOlycdMrTvr2+hpLmX6RmgusbAmDfB5ECRTtRC/gnwaIa47Ph
ZwrNtylFeHqNR0HgV4b5PwMThr23FgQTMvQJuLYHmZPKBoFjCn6XMBp3gvWSKk4w
C5WrQaLyQK6hg+jeayo9RNJOm61yKvnyizUaEAZnLfLPtdySlDdvaAcVGvlFcuYF
4zuTOYEMjOzVqIMFzPNyOPA+rt+DyhT9PSYQ7vG6wgB0AOMbExBayHXyicuJSqsb
CJVkwmLF/UJvJQDQVxa8kfNiE7vm/wmL0hOGNOh4YcAdCa+93Ulvt41VONUwfcAC
c0jGZvANqNAZHGgTl82fOWDXWbKWsZhkUQnTDzec8CQmIhgBL3cMijVvGMeI/x5D
vVbV1oDmsx8/1suLinfQ87xcmTXE7qmhyVegesAmHg/9EmdlAdH5Lrx7baBJgolM
0nQhQiAqU0ZVsSSY585ukhAheGIc/Bsdnro68oIxmQBj6wU8uIji7YqFNzoNtBJl
nzubdGsbGA9pHeYW9XEZn8/MI9KOdDX0WAPT3CM/BX0ummQWY/z5gP5KaHgDUDWJ
Qmb1ZV5b+y/+f/wNgMl2fKUAsZJJe4F5eoRiGafuW4ocekiej/g=
=0Iqf
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org