tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Session timeout during method execution
Date Wed, 31 Jan 2007 17:02:14 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bryan,

Bryan Basham wrote:
> Did you know that you have programmatic control over the
> session timeout[?]  Simply call the setMaxInactiveInterval method
> on the HttpSession object with a value in seconds.

This is the method the OP is already using, and it does not appear to
work. The OP tried session.setMaxInactiveInterval(-1), which is
documented to turn off session timeouts altogether (but I wouldn't
recommend).

> Caveats:  You will need to reset the inactive interval back to
> five minutes when the request has completed processing or
> this value will be used for the rest of that user's session.

This was done by the OP in the initial attempt.

> Second caveat: Have you verified that the browser or server
> will not "timeout" during this long request cycle?

This was already pointed out (by me, in fact). Sometimes, you can trick
the browser into keeping the connection open by sending data back little
by little. For instance, I think you might be able to keep the
connection open by sending HTML comments like "<!-- still processing
request -->" every so often. I've never tried it, but it might work.

The best strategy for long-running requests is to have the
background-processing occur in a separate thread and have the user's
browser make regular requests to see if processing is complete. This
solves the session timeout problem (just have the browser re-request the
"update" page every 60 seconds or so and the session won't time out) and
the browser timeout problem (since you aren't waiting for 10 minutes for
data to come back).

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFwMuW9CaO5/Lv0PARAhl9AJ9EEufJSPgpeJFTkqpaLvG39ji2wgCfTUSZ
Hv/wBucIRiZ+rZ00GpvGJ+k=
=iGi9
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message