You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Shapira, Yoav" <Yo...@mpi.com> on 2003/01/27 16:32:26 UTC

Cleanup of javax.servlet.context.tempdir

Howdy,
So tomcat provides a temporary directory per-cotnext accessible via
javax.servlet.context.tempdir per the 2.3 Servlet Specification.  No
problem there.

I don't think the spec (including the 2.4 PFD version) says anything
about cleaning up the temporary directory.  Does tomcat provide any
mechanisms for administrative cleanup (e.g. via the manager app) of the
temporary directories?  Does tomcat provide any mechanism, e.g. a
configuration parameter on the <Context> tag, for automatic cleanup of
the temporary directory when the context is shut down?  Does anyone
think these things would be useful?

My current scenario is a webapp that needs to write temporary files
(intermediate things in large scientific calculations) to disk.  I write
them to the context temporary directory.  One part of the cronjob that
periodically (weekly) restarts tomcat cleans up the tempdir.  This works
fine, but I'm wondering if there's a better way.

Any ideas, opinions, etc. will be appreciated.  If people think it's
useful, I could write and contribute some code to implement one or more
of the above in tomcat 4.1.x / 5.x.  Thanks,

Yoav Shapira
Millennium ChemInformatics



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Cleanup of javax.servlet.context.tempdir

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Mon, 27 Jan 2003, Glenn Nielsen wrote:

> Date: Mon, 27 Jan 2003 11:11:29 -0600
> From: Glenn Nielsen <gl...@mail.more.net>
> Reply-To: Tomcat Developers List <to...@jakarta.apache.org>,
>      glenn@mail.more.net
> To: Tomcat Developers List <to...@jakarta.apache.org>
> Subject: Re: Cleanup of javax.servlet.context.tempdir
>
> As of Tomcat 4.1.19 the manager will remove the tempdir when you
> /remove a web application.
>
> In your case I would add some code to a servlet init method to cleanup
> the old temporary files. Then configure the servlet to load on startup.
>

Or the contextDestroyed() method of a ServletContextListener.

> I would not want the manager to muck around with the tempdir of an
> installed web application.  There are many things that can get saved
> in the tempdir.  JSP .java and .class files, serialized session data,
> etc.  I think it is best if the code which generates temp files in the
> tempdir manages its own files.
>

+1.

> Regards,
>
> Glenn
>

Craig



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Cleanup of javax.servlet.context.tempdir

Posted by Glenn Nielsen <gl...@mail.more.net>.
As of Tomcat 4.1.19 the manager will remove the tempdir when you
/remove a web application.

In your case I would add some code to a servlet init method to cleanup
the old temporary files. Then configure the servlet to load on startup.

I would not want the manager to muck around with the tempdir of an
installed web application.  There are many things that can get saved
in the tempdir.  JSP .java and .class files, serialized session data,
etc.  I think it is best if the code which generates temp files in the
tempdir manages its own files.

Regards,

Glenn

Shapira, Yoav wrote:
> Howdy,
> So tomcat provides a temporary directory per-cotnext accessible via
> javax.servlet.context.tempdir per the 2.3 Servlet Specification.  No
> problem there.
> 
> I don't think the spec (including the 2.4 PFD version) says anything
> about cleaning up the temporary directory.  Does tomcat provide any
> mechanisms for administrative cleanup (e.g. via the manager app) of the
> temporary directories?  Does tomcat provide any mechanism, e.g. a
> configuration parameter on the <Context> tag, for automatic cleanup of
> the temporary directory when the context is shut down?  Does anyone
> think these things would be useful?
> 
> My current scenario is a webapp that needs to write temporary files
> (intermediate things in large scientific calculations) to disk.  I write
> them to the context temporary directory.  One part of the cronjob that
> periodically (weekly) restarts tomcat cleans up the tempdir.  This works
> fine, but I'm wondering if there's a better way.
> 
> Any ideas, opinions, etc. will be appreciated.  If people think it's
> useful, I could write and contribute some code to implement one or more
> of the above in tomcat 4.1.x / 5.x.  Thanks,
> 
> Yoav Shapira
> Millennium ChemInformatics
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org
> 


-- 
----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>