Hi Alexander, Google also provides a servlet to help with deleting stale session info. Have a look at this thread:
http://groups.google.com/group/google-appengine-java/browse_thread/thread/4f0d9af1c633d39a Best regards, Stefan On 23 Nov., 18:06, Alexander Arendar <[email protected]> wrote: > thank you Stephen :) you really helped > > On Tue, Nov 23, 2010 at 6:31 PM, Stephen Johnson > <[email protected]>wrote: > > > > > > > > > Hi Alexander, > > I'm sorry but I don't work for Google (however I did stay at a Holiday Inn > > Express last night) so I can't write it in the docs this information and I > > don't know that it's documented anywhere. Also note that the _ah_SESSION > > table does not remove expired sessions, you will need to clean up this > > yourself. > > Stephen > > > On Mon, Nov 22, 2010 at 12:43 PM, Alexander Arendar < > > [email protected]> wrote: > > >> Hi Stephen, > > >> Would also be great if you write such limitations somewhere in the > >> documentation. > >> Or maybe it is already described but I missed the link. In such case > >> please drop the link. > > >> Sincerely, > >> Alex > > >> On Mon, Nov 22, 2010 at 8:39 PM, Stephen Johnson > >> <[email protected]>wrote: > > >>> 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%2B > >>>> [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]<google-appengine-java%2B > >>> [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]<google-appengine-java%2B > >> [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]<google-appengine-java%2B > > [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.
