[vfs] Files in "..temp\vfs_cache" are not deleted after read zip

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

[vfs] Files in "..temp\vfs_cache" are not deleted after read zip

JavaDev7
This post was updated on .
Hi everybody,

I don'tknow how to ensure that files after processing will be
deleted from "Temp\vfs_cache" ..

I have multithreaded aplication.
Each thread read remote zip archives ...

My code looks like this:

StandardFileSystemManager fsm = new StandardFileSystemManager();
fsm.setCacheStrategy(CacheStrategy.ON_CALL);
fsm.init();

// do some job.. read zip and get content to byte[]
/*
FileName fName = fsm.resolveURI(...)
FileObject dir = fsm.resolveFile("zip:" + fName.toString());
FileObject[] fObjs = dir.getChildren(); // get files in zip
process fObjs ...
*/

If I call fsm.close() -> files are not clear from \Temp\vfs_cache

I also tried almost everything:

FileSystem fs = dir.getFileSystem();
fsm.closeFileSystem(fs);
fsm.getFilesCache().removeFile(fs, fName);

PrivilegedFileReplicator fr = (PrivilegedFileReplicator)fsm.getReplicator();
fr.close();

Not is working.. :(

I need read zip file (content of zip archive) which are on other host so I need cache because,
if I set NullFilesCache on fsm exception is thrown:
org.apache.commons.vfs.FileSystemException: Could not list the contents of "zip:http://..."
after I call getChilder()..

What is wrong with my code ?

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: [vfs] Files in "..temp\vfs_cache" are not deleted after read zip

JavaDev7
Problem solved.. :)
I use three implementation and in one I forgot to call fsm.close()
all files was removed from vfs_cache folder ..