Spring Integration

org.springframework.integration.file
Interface FileLocker

All Known Implementing Classes:
AbstractFileLockerFilter, NioFileLocker

public interface FileLocker

A FileLocker is a strategy that can ensure that files are only processed a single time. Implementations are free to implement any relation between locking and unlocking. This means that there are no safety guarantees in the contract, defining these guarantees is up to the implementation. If a filter that respects locks is required extend AbstractFileLockerFilter instead.

Since:
2.0
Author:
Iwein Fuld

Method Summary
 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.
 

Method Detail

lock

boolean lock(java.io.File fileToLock)
Tries to lock the given file and returns true if it was successful, false otherwise.

Parameters:
fileToLock - the file that should be locked according to this locker

isLockable

boolean isLockable(java.io.File file)
Checks whether the file passed in can be locked by this locker. This method never changes the locked state.

Returns:
true if the file was locked by another locker than this locker

unlock

void unlock(java.io.File fileToUnlock)
Unlocks the given file.

Parameters:
fileToUnlock - the file that should be unlocked according to this locker

Spring Integration