Results 1 to 2 of 2

Thread: Session Timeout

  1. #1
    Join Date
    May 2008
    Location
    Berlin, Germany
    Posts
    36

    Default Session Timeout

    Have created a mvc app (spring 2.5.5, s2ap rc1) using a session scoped bean to hold messaging network providers.

    I have implemented a:
    @PostConstruct
    public void postConstruct(){

    as well as a
    @PreDestroy
    public void preDestroy(){

    to setup and destroy messaging-network-connections (e.g. connection to gtalk) accordingly.

    The session is properly filled and maintained as long as the session is active.

    The session-object however frequently stays alive when the frontend-session is timed out.
    The @PreDestroy method is rarely called.

    The behavior is for me very easily traceable. As the sessionObject holds a connection to the gtalk messaging network, a valid session is reflected by the appropriate user being online.

    Even redeploying the application does not automatically destroy the session.

    What I am looking for is a hint how to hunt down the problem.

    From my point of view a timed out session in the browser / tomcat should automatically lead to a removement of the session-object (which implies the removement of the gtalk connection).

    Anx idea ??

    thanks in advance

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    @PostContruct/@PreDestroy are only hints for the ApplicationContext, so they aren't called when the session is destroyed. After creating the object isn't under control of the spring container any more.

    You probably need to write a session listener that acts upon the destruction of the session. Scan the objects see if they can be destroyed. You might want to create a JIRA for this I can see this as a valuable addition.

    Even redeploying the application does not automatically destroy the session.
    Tomcat by default serializes the active sessions to disk and restoring them at startup.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •