> From: Todd Hivnor [mailto:spambox_98...@yahoo.com]
> One challenge with Peter's suggestion of tracking the
> number of sessions myself is that I have a collection
> of webapps. So I can't just set up a shared static counter;
> I need a counter which works across multiple webapps.
> The only way I know to do that is to use a text file,
> and take care about locking the file before updating it.
> Or perhaps I can use ServletContext.

Some classes can be shared across webapps, though the precise approach varies 
depending on the version.  See the "Classloader how-to" for your Tomcat version 
at http://tomcat.apache.org for details.  Pre-6.0, you could load a class 
through the common or shared classloaders; in 6.0, your options are reduced 
somewhat.  That class could keep a common integer.  It doesn't have to be a 
straight session count; you could weight it based on the relative sizes of the 
sessions.  A heavy session increments the counter by 10, a light one by 1.

                - Peter

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

Reply via email to