commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <>
Subject RE: Best practive for invoking VFS.close()
Date Mon, 16 Feb 2009 22:54:18 GMT

> -----Original Message-----
> From: Suresh Pendap []

> Currently we are not invoking the (DefaultFileSystemManager).close ()
> method at all.   I would like to know if it can have any potential Out
> of Memory issues or any other performance related issues.

Under the hood, a SoftRef-cache holds the references to the resolved files. As long as one
of your objects holds a strong refrence to the FileObject it stays in memory. Also, you have
to take care that you call .close() on each and every file object if you do not longer need
them, only then you can be sure that the underlaying transport library has been closed.

Yes, it is tricky to do this right.

> Also would it really impact the performance if we programmatically
> create the DefaultSystemManager upon every request and then close the
> DefaultFileSystemManager instance at the end of the request?
This will be the safest way, depending on your throughput you might get a performance. But
why not simply test it on your own? Then you can be sure.

View raw message