[vfs] How to properly clear VFS Ram filesystem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[vfs] How to properly clear VFS Ram filesystem

Arbi Akhina
Hi, I'm using VFS2 to construct an in-memory filesystem (uring the ram scheme)
for tests. After each test I've to clean up (destroy all created files and
folders), I'm using the following command:

VFS.getManager().getFilesCache().close();

However this doesn't seem to clear everything! what's the proper way to do
it?

question on stackoverflow
<http://stackoverflow.com/questions/27619994/how-to-properly-clear-vfs-ram-filesystem>
Reply | Threaded
Open this post in threaded view
|

Re: [vfs] How to properly clear VFS Ram filesystem

Martin van den Bemt
FileSystemManager manager = VFS.getManager();
FileObject root = manager.resolveFile("ram:/");
manager.closeFileSystem(root.getFileSystem());

should do the trick.



Mvgr,
Martin

2014-12-24 11:29 GMT+01:00 Arbi Akhina <[hidden email]>:

> Hi, I'm using VFS2 to construct an in-memory filesystem (uring the ram scheme)
> for tests. After each test I've to clean up (destroy all created files and
> folders), I'm using the following command:
>
> VFS.getManager().getFilesCache().close();
>
> However this doesn't seem to clear everything! what's the proper way to do
> it?
>
> question on stackoverflow
> <http://stackoverflow.com/questions/27619994/how-to-properly-clear-vfs-ram-filesystem>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [vfs] How to properly clear VFS Ram filesystem

Bernd Eckenfels
Hello,

there are a number of leak fixes in the trunk (upcoming 2.1), this
might be needed to get the close really purge the cache. Arbi, can you
check and let us know if it works in 2.0 and if not, if 2.1 is fine?

(and yes, I also wonder why we have no .close() on FileSystem :)

Gruss
Bernd


Am Wed, 24 Dec 2014
17:45:23 +0100 schrieb Martin van den Bemt <[hidden email]>:

> FileSystemManager manager = VFS.getManager();
> FileObject root = manager.resolveFile("ram:/");
> manager.closeFileSystem(root.getFileSystem());
>
> should do the trick.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]