>From what I know you don't get sessionDestroyed. I believe there's a couple
of issues with notification of a destroyed session and the most significant
one would be that there's no guarantee that an instance of your application
will even be running (1.4.0 will allow reserved instances but that isn't out
yet.) Other issues would be that since this is a distributed environment
which instance should receive sessionDestroyed. GAE would have to implement
this one their backend. I believe sessions currently are just created by the
Servlet Context of an instance when necessary and that instance's
sessionCreated is the one that is executed.

You however can query the _ah_SESSION table to see if a given session is
still active or has expired.

On Mon, Nov 22, 2010 at 9:32 AM, Sergiy Arendar <[email protected]> wrote:

> Hi, I have a problem:
> In my application I'm using HttpSessionListener to manage sessions.
> Here is the class:
>
> package com.sergiyarendar.listeners;
>
> import java.util.logging.Logger;
> import javax.servlet.http.HttpSessionEvent;
> import javax.servlet.http.HttpSessionListener;
> import com.sergiyarendar.services.CounterService;
>
> public class SessionListener implements HttpSessionListener{
>        private static final Logger log =
> Logger.getLogger(SessionListener.class.getName());
>        private static int sessionNumber;
>        public void sessionCreated(HttpSessionEvent se){
>                log.info("Session Created");
>                sessionNumber = CounterService.getSessionNumber();
>                sessionNumber++;
>                CounterService.setSessionNumber(sessionNumber);
>    }
>        public void sessionDestroyed(HttpSessionEvent se){
>                log.info("Session Destroyed");
>                sessionNumber = CounterService.getSessionNumber();
>                sessionNumber--;
>                CounterService.setSessionNumber(sessionNumber);
>        }
> }
>
> This is what I have in web.xml file:
>
> <listener>
>
>  <listener-class>com.sergiyarendar.listeners.SessionListener</listener-
> class>
> </listener>
>
> The problem is that public void sessionCreated(HttpSessionEvent se)
> method is invoked if a new session is created, BUT public void
> sessionDestroyed(HttpSessionEvent se) method is never invoked. I'm
> setting the timeout for the sessions using setMaxInactiveInterval(120)
> method when the session begin.
>
> Can anyone say me what is the problem? Is it a GAE bug, or some thing
> is wrong with my code? Please, it is very important, becouse whithout
> sessionDestroyed() method I can't do any tasks of session management
> when the session is destroyed.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine-java%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to