The answer to your question: 
  
  the typical use is something like this:

  if (session.isNew()) {
    // store listener object in the session.
  }

  Now your Listener will be called when the session 
  is started (valueBound()) and when it ends (valueUnbound() 
  that's the one where you could kill the jobs)

To find out the number of active session you have to 
implement a Listener as above that increases an 'global' 
var with every valueBound() and decreases it with every 
valueUnbound().

> -----Ursprüngliche Nachricht-----
> Von: Ashish Kulkarni [mailto:[EMAIL PROTECTED]]
> Gesendet: Mittwoch, 14. August 2002 17:48
> An: Tomcat Users List
> Betreff: Re: AW: How to keep track of sessions
> 
> 
> Hi,
> Does this mean like implementing a ActionListener
> interface in swing, once i write a class which
> implements this listener automtically events will be
> caught when a new session is created or session is
> getting invalidated...
> 
> In AS/400 when ever i create a user login, there is 
> job which is started in the subsystem. and this job
> remains in the subsystem untill the user signsoff, i
> have tried using the session-timeout in web.xml, but
> found that even after the session is invalidated in
> tomcat, but still this job is running on as/400 so i
> want to write some code which will mkae sure that i
> kill this job running on as/400 when the session is
> being invalidated. also is there a way i can find out 
> the number of
> active sessions in tomcat???
> 
> Ashish
> 
> Ralph Einfeldt <[EMAIL PROTECTED]> wrote:
> > I think you make it a bit to comlicated.
> > 
> > The session is invalidated automatically by tomcat.
> > (See <session-timeout> in web.xml)
> > 
> > The only thing that you have to do is implement a 
> > HttpSessionBindingListener store an instance of
> > this class in the session.
> > 
> > What job are you talking about? Do you start an
> > operation system job whenever a session is started? 
> > Or do start a java thread or what ?
> > 
> > > -----Ursprüngliche Nachricht-----
> > > Von: Ashish Kulkarni
> > [mailto:[EMAIL PROTECTED]]
> > > Gesendet: Mittwoch, 14. August 2002 17:14
> > > An: Tomcat Users List
> > > Betreff: Re: How to keep track of sessions
> > > 
> > > 
> > > Hi 
> > > Can some one provide with some java code where in
> > they
> > > have used HttpSessionListener, and then stored the
> > > sessions in a vector when a new session is
> > created,
> > > and remove it when it is invalidated.
> > > i m developing a webapplication where in the
> > database
> > > is as400, so when ever a user logs in a job is run
> > on
> > > as/400, but if the user just closes the browser
> > > without signing out, then this job runs on as/400
> > > untill i restart tomcat,  so i would like to know
> > when
> > > the user closes the browser, but there is no way i
> > 
> > > can find it out, so i think i will store all the
> > > sessions created in a vector, and when the user
> > > signoff I will remove the session from vector and
> > then
> > > also run schedule job say after 30 min which will
> > > check the session from the vector,to find when was
> > it
> > > used last time, and if it is more then some time
> > say
> > > 30 min, invalidate that session, which will stop
> > the
> > > job running on as400 is there a better way of
> > doing it..
> > > Ashish
> > 
> > --
> > To unsubscribe, e-mail:  
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com
> 
> --
> To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to