Re: Sessions are dying ...

Well, the specification doesn't specify the unit (seconds or milliseconds), and
with Jigsaw setMaxInactiveInterval() needs an interval in milliseconds, not
in seconds.
Of course, if the interval is 10 miliseconds, the session will be invalidate
each time the sweeper will check it (by defaut: 30s).

But, I'm going to change that to be in seconds...

Regards, Benoit.

Augusto Sellhorn wrote:

> My configuration is Jigsaw 2.0.2 , JSDK 2.1, JDK 1.1.6 (AIX) and NS 4.5
>
> My sessions objects are being nuked every 30 seconds. It doesn't matter
> what value I set for setMaxInactiveInterval() , every 30 seconds, it
> creates a new session object.
>
> Also, why are my session objects being killed ? I thought since the
> session is being used (reg.getSession()) that should keep the session
> alive ?
>
> Here's a sample servlet to test this behavior. Use the servlet and
> hit shit-reload every second or so. You'll see that the session dies
> even though you're using it every second.
>
> <pre>
> +==================================
> import java.io.*;
> import java.util.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class TestSession extends HttpServlet
> {
>         static Vector history = new Vector();
>
>         public void doGet(HttpServletRequest req, HttpServletResponse
> res)
>                 throws ServletException, IOException
>         {
>                 HttpSession session = req.getSession(true);
>                 if (session.isNew())
>                 history.addElement("Session " + session.getId() + "
> created " +
>                         new Date(session.getCreationTime()));
>                 res.setContentType("text/html");
>                 PrintWriter out= res.getWriter();
>
>                 session.setMaxInactiveInterval(10);
>
>                 out.println("<title>TestSession</title><html><pre>Here
> is your session information : <br>");
>                 out.println("<br>= SESSION
> ============================================");
>                 if (session.isNew())    out.println("<br><B>***** NEW
> SESSION *****</B>");
>                 out.println("<br>Session : " + session );
>                 out.println("<br>ID      : " + session.getId());
>                 out.println("<br>Created : " + new
> Date(session.getCreationTime()));
>                 out.println("<br>Accessed: " + new
> Date(session.getLastAccessedTime()));
>                 out.println("<br>Inactive: " +
> session.getMaxInactiveInterval() + " seconds.");
>                 out.println("<br>isNew   : " + session.isNew());
>                 if (session.isNew())    out.println("<br><br><B>*****
> NEW SESSION *****</B>");
>
>                 out.println("<br><br>Session creation History;");
>                 Enumeration e = history.elements();
>                 while (e.hasMoreElements())
> out.println((String)e.nextElement());
>
> out.println("<br>======================================================");
>
>                 out.println("</pre></html>");
>         }
> }
> +==================================
> </pre>
>
> Here's some sample output
>
> +================================
>
> Here is your session information :
>
> = SESSION ============================================
> ***** NEW SESSION *****
> Session : org.w3c.jigsaw.servlet.JigsawHttpSession@603437d
> ID      : J-40105124-63
> Created : Wed Jul 14 11:56:38 EDT 1999
> Accessed: Wed Jul 14 11:56:38 EDT 1999
> Inactive: 10 seconds.
> isNew   : true
> ***** NEW SESSION *****
> Session creation History;
> Session J-40411524-59 created Wed Jul 14 11:51:31 EDT 1999
> Session J-40383748-60 created Wed Jul 14 11:51:59 EDT 1999
> Session J-40353662-61 created Wed Jul 14 11:52:29 EDT 1999
> Session J-40323644-62 created Wed Jul 14 11:52:59 EDT 1999
> Session J-40105124-63 created Wed Jul 14 11:56:38 EDT 1999
> ======================================================

--
- Benoît Mahé -------------------------------------------------------
                      World Wide Web Consortium   (W3C)
                    Architecture domain - Jigsaw Engineer

                http://www.w3.org/People/Mahe  - bmahe@w3.org
---------------------------------------------------------------------

Received on Thursday, 15 July 1999 09:51:35 UTC