You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Simon Kitching <sk...@apache.org> on 2005/03/18 23:31:01 UTC
Re: deleteOnExit doesn't seem to be working for session temporary
files..
On Fri, 2005-03-18 at 10:27 -0800, Joseph Silverman wrote:
> In our setup, we have JSP's that create a "temporary" file with the
> deleteOnExit flag set.
> The session timeout (getMaxInactiveInterval) appears to be the
> "default" of 1800 seconds (30 minutes).
>
> We are blasting our servlet container (tomcat and jetty) with JSP
> fetches (that don't handle cookies - http_load if you are curious as to
> what we are using) and noting that these files stick around till the
> servlet container itself quits (the java process goes away). At that
> point ALL the files are deleted, and it can take HOURS in some cases to
> do so.
>
> Is this expected behavior? We think that these files should be deleted
> when the session "expires". That seems like the right thing to do.
What you are seeing is what I would expect. The javadoc for
File.deleteOnExit very clearly states that the file is deleted *when the
virtual machine terminates*.
A session is *not* a virtual machine.
I suggest you use a SessionListener object instead; this should be
invoked when the session expires, and you can delete the files then.
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org