public class NioFileLocker extends AbstractFileLockerFilter
FileReadingMessageSources sharing a
Locker will not pick up the same files.
This implementation will acquire or create a FileLock for the given file. Caching locks might be expensive,
so this locking strategy is not recommended for scenarios where many files are accessed in parallel.
| Constructor and Description |
|---|
NioFileLocker() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isLockable(File file)
Checks whether the file passed in can be locked by this locker.
|
boolean |
lock(File fileToLock)
Tries to lock the given file and returns
true if it was
successful, false otherwise. |
void |
unlock(File fileToUnlock)
Unlocks the given file.
|
acceptfilterFiles, supportsSingleFileFilteringpublic boolean lock(File fileToLock)
FileLockertrue if it was
successful, false otherwise.fileToLock - the file that should be locked according to this lockerpublic boolean isLockable(File file)
FileLockerfile - The file.public void unlock(File fileToUnlock)
FileLockerfileToUnlock - the file that should be unlocked according to this locker