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(java.io.File file)
Checks whether the file passed in can be locked by this locker.
|
boolean |
lock(java.io.File fileToLock)
Tries to lock the given file and returns
true if it was
successful, false otherwise. |
void |
unlock(java.io.File fileToUnlock)
Unlocks the given file.
|
acceptfilterFilespublic boolean lock(java.io.File fileToLock)
FileLockertrue if it was
successful, false otherwise.fileToLock - the file that should be locked according to this lockerpublic boolean isLockable(java.io.File file)
FileLockerfile - The file.public void unlock(java.io.File fileToUnlock)
FileLockerfileToUnlock - the file that should be unlocked according to this locker