|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.integration.file.AbstractFileListFilter org.springframework.integration.file.locking.BaseLockingFilter org.springframework.integration.file.locking.NioFileLocker
public class NioFileLocker
File locking strategy that uses java.nio. The locks taken by FileChannel are
shared with all the threads in a single JVM, so this locking strategy does
not prevent files being picked up multiple times within the same JVM.
FileReadingMessageSource
s 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 Summary | |
---|---|
NioFileLocker()
|
Method Summary | |
---|---|
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. |
Methods inherited from class org.springframework.integration.file.locking.BaseLockingFilter |
---|
accept |
Methods inherited from class org.springframework.integration.file.AbstractFileListFilter |
---|
filterFiles |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NioFileLocker()
Method Detail |
---|
public boolean lock(java.io.File fileToLock)
true
if it was
successful, false
otherwise.
public void unlock(java.io.File fileToUnlock)
FileLocker
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |