tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Brian.Horb...@thomson.com>
Subject RE: How do you access all sessions from a servlet in tomcat 6.0?
Date Wed, 19 Sep 2007 14:13:50 GMT

Gary,

I'm not sure how much time was spent discussing alternatives as apposed
to the question of if getting access to all sessions would work. 

You originally talked about tracking for concurrent license checking...

We currently do this type of thing - and more, like abstracting the
session from the http session so the http session can time out and
return resources without actually losing the user session, concurrent
connections versus concurrent users, etc. Furthermore we have multiple
servers running the same app so that simply holding the information
locally in the VM is not sufficient. 

We handle tracking all of this stuff via the database. Thus the
distributed nature of our app and the precise lifecycle of the
HttpSession are not so important.

The downside to all this is that you have to be careful how you track
activity via the db. How/when do you log activity? How do you write your
connection-checking queries so you don't have performance issues?
How/when do you cache stuff locally to help improve performance? How do
you efficiently write logs for usage tracking? Using the DB works but it
does take some tuning (as we found out ;-).

Brian



-->-----Original Message-----
-->From: gary.l.johnstone@cummins.com 
-->[mailto:gary.l.johnstone@cummins.com] 
-->Sent: Wednesday, September 19, 2007 5:05 AM
-->To: Tomcat Users List
-->Subject: Re: How do you access all sessions from a servlet 
-->in tomcat 6.0?
-->
-->
-->Thanks for all the feedback on this.
-->
-->___________________________
-->
-->Gary Johnstone
-->Engineering IT
-->Cummins Turbo Technologies Ltd
-->+44 1484 440532
-->
-->
-->
-->
-->
-->
-->                                                             
-->              
-->             Lyallex                                         
-->              
-->             <lyallex@gmail.co                               
-->              
-->             m>                                              
-->           To 
-->                                       "Tomcat Users List"   
-->              
-->             19/09/2007 10:38          
--><users@tomcat.apache.org>           
-->                                                             
-->           cc 
-->                                                             
-->              
-->             Please respond to                               
-->      Subject 
-->               "Tomcat Users           Re: How do you access 
-->all sessions  
-->                   List"               from a servlet in 
-->tomcat 6.0?       
-->             <users@tomcat.apa                               
-->              
-->                 che.org>                                    
-->              
-->                                                             
-->              
-->                                                             
-->              
-->                                                             
-->              
-->                                                             
-->              
-->
-->
-->
-->
-->OK, for some reason I've been obsessing about this for a 
-->whole day now.
-->
-->If you hold an external reference to a Session then 
-->according to my tests the session will still time out as 
-->expected but the external reference will be non null. At the 
-->very least this means that you may end up with a large 
-->number of useless references taking up space in memory. Of 
-->course you can always remove an invalid or timed out 
-->reference in the sessionDestroyed method of your listener.
-->
-->There are a whole bunch of other issues surrounding this but 
-->I'm sure you've sussed them out for yourself already.
-->
-->Anyway, I'll shut up now.
-->
-->Rgds
-->Duncan
-->
-->
-->On 9/19/07, Lyallex <lyallex@gmail.com> wrote:
-->> On 9/18/07, Lyallex <lyallex@gmail.com> wrote:
-->> > How about creating a SessionListener
-->> >
-->> > class SomeSessionListener implements HttpSessionListener ...
-->> >
-->> > Register it in web.xml
-->> >
-->> > in the sessionCreated method of your listener get a 
-->reference to the 
-->> > new session from the HttpSessionEvent you can now access the 
-->> > getLastAccessedTime(), maybe store the refs in some singleton ...
-->>
-->> ...er, actually I think this could be a REALLY STUPID idea 
-->as I hadn't 
-->> thought about what happens if you maintain an external 
-->reference to a 
-->> session and the session expires...
-->>
-->> Investigating now
-->>
-->> Duncan
-->>
-->
-->---------------------------------------------------------------------
-->To start a new topic, e-mail: users@tomcat.apache.org To 
-->unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
-->For additional commands, e-mail: users-help@tomcat.apache.org
-->
-->
-->
-->_____________
-->This e-mail transmission and any attachments to it are 
-->intended solely for the use of the individual or entity to 
-->whom it is addressed and may contain confidential and 
-->privileged information.  If you are not the intended 
-->recipient, your use, forwarding, printing, storing, 
-->disseminating, distribution, or copying of this 
-->communication is prohibited.  If you received this 
-->communication in error, please notify the sender immediately 
-->by replying to this message and delete it from your computer.
-->
-->
-->---------------------------------------------------------------------
-->To start a new topic, e-mail: users@tomcat.apache.org To 
-->unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
-->For additional commands, e-mail: users-help@tomcat.apache.org
-->
-->

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


Mime
View raw message