commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Cooke" <Tony.Co...@elders.com.au>
Subject RE: [commons vfs] ftp DefaultFileMonitor issue
Date Fri, 07 Jul 2006 07:10:21 GMT
> Hi Tony!
> > Hi... again. Sorry. You must be getting sick and tired of me. :-)
> >
> Not yet, though, we constantly moving forward until we reach the point
> where I am out of idea, I hope you are familiar with the debugger then
;-)

When I look at what you've done already I think I'm in over my head. :-)


> > I tried changing the cache to NullFilesCache like below:
> >
> Do not change the FilesCache. Anything else than the SoftRefFilesCache
> (which is the default) will cause memory leaks and other oddities.

OK, but using that caching strategy seems to cache files no matter what
(using ftp that is), even if I use:

  mgr.setCacheStrategy(CacheStrategy.ON_CALL);

So I gather the cache is still in effect when I use DefaultFileMonitor
to monitor the files.

Ie. Even though I want the FileObject's cache refreshed every time I
check the remote ftp file I think it's still cached.

This is how I've set up my DefaultFileMonitor:

  DefaultFileMonitor fm = new DefaultFileMonitor(new FileListener() {
    public void fileCreated(FileChangeEvent arg0) throws Exception {
	System.out.println("File created. " + arg0.getFile().getName());
    }
    public void fileDeleted(FileChangeEvent arg0) throws Exception {
	System.out.println("File deleted. " + arg0.getFile().getName());
    }
    public void fileChanged(FileChangeEvent arg0) throws Exception {
	System.out.println("File changed. " + arg0.getFile().getName());
  }
  });

  fm.setDelay(60000);
  fm.addFile(file);
  fm.start();


And this is how I run my checks:

  try {
    for (int i = 0; 1 < 100; i++) {
      Thread.sleep(60000); //  1 minute
      System.out.println(file.getContent().getLastModifiedTime() + "  "
+ file.getName());
    }
  } catch (InterruptedException ie) {
    ie.printStackTrace();
  }

But the file.getContent().getLastModifiedTime() never changes.

Thanks again Mario for your help.

All the best,
Tony


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


Mime
View raw message