commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <ma...@ops.co.at>
Subject [vfs] caching (was: [vfs] LRUFilesCache safe for production use? Google App Engine/Java plug-in)
Date Tue, 26 May 2009 10:13:48 GMT
Hi!


> Actually, I commented out the call to filesystemclose in  
> SoftRelFilesCache. While looking at the FileSystem implementation I  
> realized that the way close is implemented is not thread safe and  
> can't be called while the system is running.  I believe the fix for  
> this is non-trivial.

That is strange, there should be no real problem if it is not thread safe as no other thread
is holding a reference to a fileObject any more.

Anyway, I think (and I had this on my todo to discuss this earlier, but my work load is still
way too high :-( ) all this needs a major refactoring.

First of all, instead of FileManager.resolveFile() we should introduce FileManager.mount(path)
FileManager.unmount(FileObject).

mount will always create a new file-system which will be kept only within the FileObject.

A file-system then will go away when the last FileObject is out of scope, or when one calls
FileManager.unmount(FileObject).

All the synchronization stuff might be possible to be removed and leaf to the user application.
I'd say, 90% of the use-case of VFS do not need synchronization as there is no need to reuse
the same instance of the FileObject between threads. But probably I get this wrong.

Given we keep the FileManager.resolveFile() (which then routes to .mount(path)) the side effect
would be:

1) VFS.getManager().resolveFile("/tmp") != VFS.getManager().resolveFile("/tmp")
2) VFS.getManager().mount("/tmp") != VFS.getManager().mount("/tmp")

3) FileObject fo = VFS.getManager().mount("/tmp");
fo.resolveFile("a") == fo.resolveFile("a")

4) FileObject fo2 = VFS.getManager().mount("/tmp");
fo2.resolveFile("a") == fo2.resolveFile("a")
fo.resolveFile("a") != fo2.resolveFile("a")


If we could argue that, the internals of VFS might become much easier again, and stuff like
LRUFilesCache or even NullFilesCache might start to work.
Sure, with a NullFilesCache then even 3 is not true, but this is expected then.


Hmmmm .... If we would like to go that way I might try to spent a night or two to implement
it. With VFS 2.0 it is THE time to do it, but yes, it might delay the release again. This
is something which happend with VFS always, probably a bad spell - or just me ;-)


Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message