wood burning stoves 2.0*
The moose likes Java in General and the fly likes Facing a problem during monitor the files using org.apache.commons.vfs  api Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Facing a problem during monitor the files using org.apache.commons.vfs  api" Watch "Facing a problem during monitor the files using org.apache.commons.vfs  api" New topic
Author

Facing a problem during monitor the files using org.apache.commons.vfs api

Chandru Mohan
Greenhorn

Joined: Jan 16, 2013
Posts: 2
Hi,

I want to do some specific operation after a particular file is created in the directory. so I am using apache.commons.vfs api to monitor the directory.




first time it is working fine. After create the ("XXXXXXXXX") in the directory, fileCreated method had been invoked. List of operation is executed properly after that the file also get deleted from the directory.

But in the second time if the file ("XXXXXXXXX") is created in the directory then, fileCreated method is called twice? It is happened for the remaining all execution. Any idea why it is happening like this?

It would be good if any one provide the solution for this problem. Thanks in advance.

Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1057
    
  10

Are you sure you are not adding a second instance of the listener ?
Chandru Mohan
Greenhorn

Joined: Jan 16, 2013
Posts: 2
I didnt add. Please have a look at the code below....



Regis Ramillien
Greenhorn

Joined: Feb 19, 2010
Posts: 3
Hello all,

Got the same issue. When I add twice a file with the same name, the fileCreated method is launch twice.
For instance, my process is:
- I add a first file.
- The file is processed thru the fileCreated method then removed.
- I add a second file with the same name.
- The fileCreated method is called twice...
- Every time I add a file which name was previously used, fileCreated is called twice...

I will investigate on it and post a reply if I found the cause, but if someone already encountered this, please feel free to reply.

Best regards,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Facing a problem during monitor the files using org.apache.commons.vfs api