Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Chandru Mohan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure you are not adding a second instance of the listener ?
 
Chandru Mohan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didnt add. Please have a look at the code below....



 
Regis Ramillien
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic