Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.10.3
-
None
-
Unknown
Description
We recently upgraded to 2.10.x and discovered that the file poller no longer works on our NAS. We have hit similar issues with other open source libraries in the past.
The problem occurs when MarkerFileExclusiveReadLockStrategy.acquireExclusiveReadLock is called and tries to create the new file. This actually works but also results in a Permission denied IOException (strange but true).
A simple fix for this is to change the acquireExclusiveReadLock method as follows.
public boolean acquireExclusiveReadLock(GenericFileOperations<File> operations, GenericFile<File> file, Exchange exchange) throws Exception { String lockFileName = getLockFileName(file); LOG.trace("Locking the file: {} using the lock file name: {}", file, lockFileName); // create a plain file as marker filer for locking (do not use FileLock) File lock = new File(lockFileName); boolean acquired = false; try { acquired = lock.createNewFile(); } catch (IOException e) { if (lock.exists()) { acquired = true; } else { throw e; } } return acquired; }
Note the same problem occurring with Spring Batch can be found here