Interface FileLockService


public interface FileLockService
Provides process-level file locking.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Closeable
    lock(File file)
    Locks the given file to protect read/write access from multiple processes on it.
    lock(File file, long timeout)
    Locks the given file to protect read/write access from multiple processes on it.
    Locks the given file for this JVM to protect read/write access from multiple threads in this JVM on it.
  • Method Details

    • lock

      default Closeable lock(File file)
      Locks the given file to protect read/write access from multiple processes on it. Locking is advisory only, i.e. all processes must use the same locking mechanism.

      This is equivalent to lock(File, long) with a timeout argument of 10 seconds.

    • lock

      Closeable lock(File file, long timeout)
      Locks the given file to protect read/write access from multiple processes on it. Locking is advisory only, i.e. all processes must use the same locking mechanism.
    • lockVirtually

      Closeable lockVirtually(File file)
      Locks the given file for this JVM to protect read/write access from multiple threads in this JVM on it.