Mail from Johan - Forwarded to the mailinglist too

Mario



On Wed, 07 Jul 2004 22:20:12 +0200, Mario Ivankovits <[EMAIL PROTECTED]> wrote:

So i picked up the SoftRefFilesCache and adapted it slightly.

The idea behind is - as long as a FileObject is "strongly reachable" by the jvm there must be someone who is willing to access the file and thus it is not allowed to close the filesystem.
As soon as the last file of a certain filesystem is garbage-collected the filesystem can be (and will be) closed.


For sure - now you do not have that control over this release process, but it should work well.



Much better idea - a small problem may be that garbage collection can not be forced and resources could potentially build up substantially before they are cleared ...



One has simply to ensure to release all references (assign null to it if it is a global member) to make this work.

@Johan:
I would like to remove the useCount (freeUnusedResources) stuff from vfs again. Could you please try this in your environment.


Instantiate your vfs manager like this:

StandardFileSystemManager manager = new StandardFileSystemManager();
manager.setFilesCache(new SoftRefFilesCache());
manager.init();

and remove the call to freeUnusedResources - and - as long as you do not use any input/output stream - the FileObject.close() is also no longer needet.



Have tried this and it's working fine - had to "suggest" GC a couple of times, but the references (and therefore the session) disappear after a while - excellent :)


Cheers,

Johan


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to