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

    Modifier and Type
    Method
    Description
    boolean
    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.
  • Method Details

    • lock

      boolean lock(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
      Returns:
      true if successful.
    • isLockable

      boolean isLockable(File file)
      Checks whether the file passed in can be locked by this locker. This method never changes the locked state.
      Parameters:
      file - The file.
      Returns:
      true if the file was locked by another locker than this locker
    • unlock

      void unlock(File fileToUnlock)
      Unlocks the given file.
      Parameters:
      fileToUnlock - the file that should be unlocked according to this locker