commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John (JIRA)" <j...@apache.org>
Subject [jira] Created: (VFS-268) When I set a delay on FileMonitor it detects a create on a file, but if the file is deleted/moved and created in the directory again it does not detect it
Date Mon, 06 Jul 2009 16:11:14 GMT
When I set a delay on FileMonitor it detects a create on a file, but if the file is deleted/moved
and created in the directory again it does not detect it
----------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: VFS-268
                 URL: https://issues.apache.org/jira/browse/VFS-268
             Project: Commons VFS
          Issue Type: Bug
         Environment: Windows listening on directory on unix or windows
            Reporter: John
            Priority: Blocker


I am using a DefaultFileMonitor within a FileListener to listen on a directory.  I get different
behavior when I set the monitor delay to 0 and non zero. When I set it to 0 and add files
to the directory, the createfile event is triggered, I move the files out of the directory.
If I add the same files back into the directory, the create event is again triggered.

If I set the delay to 60000, the first time the files are added the event is triggered, I
move the files out of the directory. When I add the files back into the directory, the create
event does not trigger (i.e. it triggers the first time, but only the first time).

The only difference between the situations is 1 has delay set to 60000, the other sets it
to 0 ( and I see in the code that that causes a delay of 1000).


Here is a snippet of the pertinent code.    Thanks for any information/assistance you can
find time to give.




public FileMessageListener(String dataArea, ReceiverDetail receiverRecord, 
						   FileObject fileDirectoryObject, FileObject errorDirectoryObject, 
						   FileObject processedDirectoryObject, long FileAccessCheckTime) throws Exception
	{
		this.dataArea = dataArea;
		this.channel = receiverRecord.getKey().channel;
		this.receiver = receiverRecord.getKey().receiver;
		this.processDefinition = receiverRecord.processDefinition;
		this.sendFileData = receiverRecord.filereceiverSendFileData;

		this.fileDirectoryObject = fileDirectoryObject;
		this.errorDirectoryObject = errorDirectoryObject;
		this.processedDirectoryObject = processedDirectoryObject;
		
		this.caseinsensitive = (System.getProperty("os.name").indexOf("Windows") >= 0);

		this.regexString = getRegexString(receiverRecord.filereceiverFileName);

		this.fileMonitor = new DefaultFileMonitor(this);
		this.fileMonitor.setDelay(1000 * 60 * FileAccessCheckTime);
		
		// Recursive needs to be set before files are added to the monitor.
		fileMonitor.setRecursive(false);
	
		fileMonitor.addFile(fileDirectoryObject);
		fileMonitor.start();

etc.......

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message