tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Milt Epstein <mepst...@uiuc.edu>
Subject Re: HttpSessionListener beforeSessionDestroyed (Craig, Sean)?
Date Mon, 16 Dec 2002 23:33:10 GMT
On Sat, 14 Dec 2002, Craig R. McClanahan wrote:

> On Fri, 13 Dec 2002, Garrett Smith wrote:
>
> > Date: Fri, 13 Dec 2002 18:04:42 -0800 (PST)
> > From: Garrett Smith <javadevmac2@yahoo.com>
> > Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> > To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> > Subject: HttpSessionListener beforeSessionDestroyed (Craig, Sean)?
> >
> > Hello Everyone in Java Land,
> >
> > I want to use beforeSessionDestroyed. Before going off and extending
> > HttpSessionListener, I decided to see if it'd been done (why reinvent the
> > wheel?).
> >
> > I searched on google for my aptly-named method, and found this:
> >
> > http://archives2.real-time.com/pipermail/tomcat-devel/2002-March/028610.html
> >
> > How can I use this? is there an interface for a StandardHttpSessionListener or
> > something? If so, does beforeSessionDestroyed give me access to the session
> > that is about to be destroyed?
> >
> > If not, I propose to make an interface that extends HttpSessionListener and
> > provides for beforeSessionDestroyed. To do this, I will create and store a list
> > in application scope. Each session will get added to the list. When a session
> > is destroyed, I can loop through the list and find out which session expired:
>
> In Servlet 2.3, the sessionDestroyed() method is called *after* the
> session has been expired.  In Servlet 2.4 (which is implemented by Tomcat
> 5), the current leaning of the expert group is towards changing the
> semantics of this to occur *before* the session is destroyed instead.

Would it be too much trouble to have both?  I can imagine uses for
both (mainly based on whether having access to the session itself is
required).  I'm sure this idea has come up before, what were the
feelings about it?

Also, if it's before the session is destroyed, would the session still
be accessible and changeable?  Having a hook to get in just before a
session is destroyed is useful, but moreso if you know that the
session won't be modified anymore.

Finally, I thought I saw that the 2.4 spec had reached the " proposed
final draft"; how likely is it that something like this will be
changed before it is final?  (Below you suggest sending in some feedback.)


> > for(i = 0; i < list.size(); i ++){
> >
> >         session = list.get(i);
> >
> >         if(System.currentTimeMillis()
> >            - session.getLastAccessedTime()
> >            > session.getMaxInactiveInterval())
> >                 beforeSessionDestroyed(session);
> >
> >         list.remove(i) = null;
> > }
> >
> > Any advice?
> >
>
> Obviously, this is not something that could be done in Tomcat by itself,
> because it requires a change to the Servlet API.  That can only be done by
> the JSR-154 expert group.  To send them your feedback, mail to:
>
>   servletapi-feedback@eng.sun.com

Milt Epstein
Research Programmer
Integration and Software Engineering (ISE)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
mepstein@uiuc.edu


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message