You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rui Pedro <rp...@gmail.com> on 2009/02/09 13:11:12 UTC

HttpSessionActivationListener problems

Hi!

I'm implementing one tomcat cluster solution (tomcat 5.5-20). One of the
things that I need to know is when the session jumps from one node to the
other.
I read that I can use the HttpSessionActivationListener listener to detect
that type of occurence. To do so, I put one object in the users session that
implements the HttpSessionActivationListener interface, the problem is that
when I kill one of the clusters node the methods sessionDidActivate an
sessionWillPassivate never occurr ...


Is HttpSessionActivationListener supported by tomcat?
Can you help me?



Thanks in advance,
Rui Pereira

Re: HttpSessionActivationListener problems

Posted by Flavio Crispim <fl...@sulamerica.com.br>.
Rui

the javadoc says it began on servlet spec 2.3 or since TC 4, see:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/HttpSessionActivationListener.html
it should be stable enougth. (Am I wrong?)

Before I dig a little more, I´m not sure TC can handle such event when the
java process is killed.
You could try it another way, calling session.invalidate() on another
servlet or jsp.

Regards

Flavio


Rui Pedro <rp...@gmail.com> gravou em 10/02/2009 09:13:15:

> Thank you for the help.
>
> I need to find out other solution ...
>
> Do you know any way to distinguish if the one session is invalidated by
> timeout or because the server have been shutdown?
> One of the ways is to use  session.getMaxInactiveInterval with the
current
> timestamp and the session.getLastAccessedTime, and make some calculations
> ... but this not seems me  very reliable, do you know another way to do
> that?
>
> Thanks in advance,
> Rui Pereira
>
>
> On Mon, Feb 9, 2009 at 12:20 PM, Jess Holle <je...@ptc.com> wrote:
>
> > Last I checked the Tomcat source code neither activation nor
passivation
> > listeners were ever called.
> >
> > I believe I provided a patch for this but a glance at the source code
will
> > make the issue rather obvious (it's not hard to find or understand).
> >
> > [I'd provide a patch for this but we have a number of patches to this
> > particular area of source that overlap.  Others are of a bit more
> > controversial nature and I have not kept them separate.]
> >
> > --
> > Jess Holle
> >
> >
> > Rui Pedro wrote:
> >
> >> Hi!
> >>
> >> I'm implementing one tomcat cluster solution (tomcat 5.5-20). One of
the
> >> things that I need to know is when the session jumps from one node to
the
> >> other.
> >> I read that I can use the HttpSessionActivationListener listener to
detect
> >> that type of occurence. To do so, I put one object in the users
session
> >> that
> >> implements the HttpSessionActivationListener interface, the problem is
> >> that
> >> when I kill one of the clusters node the methods sessionDidActivate an
> >> sessionWillPassivate never occurr ...
> >>
> >>
> >> Is HttpSessionActivationListener supported by tomcat?
> >> Can you help me?
> >>
> >>
> >>
> >> Thanks in advance,
> >> Rui Pereira
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >


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


Re: HttpSessionActivationListener problems

Posted by Rui Pedro <rp...@gmail.com>.
Thank you for the help.

I need to find out other solution ...

Do you know any way to distinguish if the one session is invalidated by
timeout or because the server have been shutdown?
One of the ways is to use  session.getMaxInactiveInterval with the current
timestamp and the session.getLastAccessedTime, and make some calculations
... but this not seems me  very reliable, do you know another way to do
that?

Thanks in advance,
Rui Pereira


On Mon, Feb 9, 2009 at 12:20 PM, Jess Holle <je...@ptc.com> wrote:

> Last I checked the Tomcat source code neither activation nor passivation
> listeners were ever called.
>
> I believe I provided a patch for this but a glance at the source code will
> make the issue rather obvious (it's not hard to find or understand).
>
> [I'd provide a patch for this but we have a number of patches to this
> particular area of source that overlap.  Others are of a bit more
> controversial nature and I have not kept them separate.]
>
> --
> Jess Holle
>
>
> Rui Pedro wrote:
>
>> Hi!
>>
>> I'm implementing one tomcat cluster solution (tomcat 5.5-20). One of the
>> things that I need to know is when the session jumps from one node to the
>> other.
>> I read that I can use the HttpSessionActivationListener listener to detect
>> that type of occurence. To do so, I put one object in the users session
>> that
>> implements the HttpSessionActivationListener interface, the problem is
>> that
>> when I kill one of the clusters node the methods sessionDidActivate an
>> sessionWillPassivate never occurr ...
>>
>>
>> Is HttpSessionActivationListener supported by tomcat?
>> Can you help me?
>>
>>
>>
>> Thanks in advance,
>> Rui Pereira
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: HttpSessionActivationListener problems

Posted by Jess Holle <je...@ptc.com>.
Last I checked the Tomcat source code neither activation nor passivation 
listeners were ever called.

I believe I provided a patch for this but a glance at the source code 
will make the issue rather obvious (it's not hard to find or understand).

[I'd provide a patch for this but we have a number of patches to this 
particular area of source that overlap.  Others are of a bit more 
controversial nature and I have not kept them separate.]

--
Jess Holle

Rui Pedro wrote:
> Hi!
>
> I'm implementing one tomcat cluster solution (tomcat 5.5-20). One of the
> things that I need to know is when the session jumps from one node to the
> other.
> I read that I can use the HttpSessionActivationListener listener to detect
> that type of occurence. To do so, I put one object in the users session that
> implements the HttpSessionActivationListener interface, the problem is that
> when I kill one of the clusters node the methods sessionDidActivate an
> sessionWillPassivate never occurr ...
>
>
> Is HttpSessionActivationListener supported by tomcat?
> Can you help me?
>
>
>
> Thanks in advance,
> Rui Pereira
>
>   


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