How to manage the creation and deletion of temporary files
I'm adding code to a large JSP web application, integrating functionality
to convert CGM files to PDFs (or PDFs to CGMs) to display to the user.
It looks like I can create the converted files and store them in the
directory designated by System.getProperty("java.io.tmpdir"). How do I
manage their deletion, though? The program resides on a Linux-based
server. Will the OS automatically delete from /tmp or will I need to come
up with functionality myself? If it's the latter scenario, what are good
ways to go about doing it?
EDIT: I see I can use deleteOnExit() (relevant answer elsewhere), but I
think the JVM runs more or less continuously in the background so I'm not
sure if the exits would be frequent enough.
I don't think I need to cache any converted files--just convert a file
anew every time it's needed.
No comments:
Post a Comment