You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Mirko Sertic <Mi...@dtmgmbh.de> on 2002/05/08 08:48:38 UTC

File seems to be kept open!

Hi there again.

I'm running my FOP formatter in a java standalone application
and let it render PDF's the hole day.

It acts like a converter-server. Clients are giving it the xml
and xsl file and the formatter does the rest.

Sometimes it has also to render some images into the pdf file.
These files are saved in a temp file so that the renderer can
access it properly.

And there is the problem!

After the renderer has done its work, i want to delete my temp 
files. I can delete every temp file except the image files!!!
(the java java.io.File.delete() method gives a false as return
value, so the the file is not deleted and is still alive in
my temp dir!!!).

I do not like this because the formatter is doing a lot of work
the hole day, and after a week or so, my disk would be full because
of these temp files!

Any idea?


Thanks

Mirko


Re: File seems to be kept open!

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Mirko Sertic wrote:
> After the renderer has done its work, i want to delete my temp 
> files. I can delete every temp file except the image files!!!
> (the java java.io.File.delete() method gives a false as return
> value, so the the file is not deleted and is still alive in
> my temp dir!!!).
The files are automatically closed when the corresponding Java
objects are garbage collected. This will happen sooner or later,
so you can simply try to delete *all* temporary image files and
ignore the ones which are not yet closed.
Another possibility is to explicitely force garbage collection
check the JavaDoc for the System or Runtime class. Be careful
to set references to the driver object to null beforehand:
   driver.render();
   driver=null;
   System.gc(); // or whatever

J.Pietschmann