David Thielen wrote:
One note to the below:

It does call it on a timeout under 4.1.24 (it did not do that in 4.1.18).
But it does not call it if Tomcat is reloaded or exits - which according to
the spec it is supposed to do.

Two things: 1) When you stop Tomcat, it saves all session data to disk; it does not terminate the sessions at this time, so don't expect a valueUnbound() call immediately at stop. When Tomcat is restarted, it loads all session data again and eventually calls valueUnbound() when it finds that the session has timed out. Also note that it only checks for timeouts every 1 second, so that's the shortest time-out value that is honored. 2) In order to save and reload the session data, all objects in the session must be serializable, e.g. implement java.io.Serializable. Your FileList class doesn't, so it can be saved and reloaded, hence the valueUnbound() method is never called after a restart.

Arguably, there's still a bug here. There's a comment in the Standard-
Session class for the method that saves the session data that any object
that is not serializable "will be unbound from the session, with
appropriate actions if it implements HttpSessionBindingListener," which
I assume mean valueUnbound() will be called. I don't see any signs of
this being done, however. You may want to file a bug report about this.

For a class that implements Serializable, however, everything seems to
work as it should in 4.1.24.

Hans

----- Original Message -----
From: "David Thielen" <[EMAIL PROTECTED]>
To: ""Hans Bergsten"" <[EMAIL PROTECTED]>
Cc: "Tomcat - dev" <[EMAIL PROTECTED]>
Sent: Sunday, March 30, 2003 1:04 PM
Subject: Re: HttpSessionBindingListener.valueUnbound() not called


Nope - with 4.1.24 I still get called for valueBound() but not valueUnbound().

Any other ideas?


code:


public class FileList implements HttpSessionBindingListener {
    public void valueBound(HttpSessionBindingEvent event) {
        event.getSession().getServletContext().log( "bind" );
    }

    public void valueUnbound(HttpSessionBindingEvent event) {
        // never logged
        event.getSession().getServletContext().log( "unbind" );
    }
}





----- Original Message -----
From: "Hans Bergsten" <[EMAIL PROTECTED]>
To: "Tomcat Developers List" <[EMAIL PROTECTED]>
Sent: Saturday, March 29, 2003 2:19 PM
Subject: Re: HttpSessionBindingListener.valueUnbound() not called



David Thielen wrote:

Hi;

I have an object that implements HttpSessionBindingListener. It calls
valueBound fine. But it never calls valueUnbound. Not when it times out

and

not when Tomcat is closed. I am running 4.1.18.

Any ideas?

It works fine in TC 4.1.24, so you may want to upgrade.


Hans
--
Hans Bergsten                                <[EMAIL PROTECTED]>
Gefion Software                       <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at                                    <http://TheJSPBook.com/>


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





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



--
Hans Bergsten                                <[EMAIL PROTECTED]>
Gefion Software                       <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at                                    <http://TheJSPBook.com/>


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



Reply via email to