Interface ISynchronizedFileSystem<FD>

  • Type Parameters:
    FD - The type of the file descriptor.
    All Superinterfaces:
    AutoCloseable, ICommonFileSystem<FD>

    public interface ISynchronizedFileSystem<FD>
    extends ICommonFileSystem<FD>
    A file system that is synchronized. Provides a few additional method related to synchronization.

    All operations are thread-safe and atomic. However, executing multiple operations in sequence is not atomic. You need to apply the appropriate synchronization yourself if you need to ensure atomicity across multiple operations. You can do so by acquiring a lock using one of the lock methods.

    Since:
    8.3.0
    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • lock

        QuietAutoCloseable lock​(FD file)
        Locks access to the specified file. The lock is released when the returned AutoCloseable is closed. Until the lock is released, no other thread can access the file.
        Parameters:
        file - The file to lock.
        Returns:
        An AutoCloseable that releases the lock when closed.
      • lock

        QuietAutoCloseable lock​(FD... files)
        Locks access to the specified files. The lock is released when the returned AutoCloseable is closed. Until the lock is released, no other thread can access the files.
        Parameters:
        files - The files to lock.
        Returns:
        An AutoCloseable that releases the lock when closed.
      • lock

        QuietAutoCloseable lock​(Iterable<FD> files)
        Locks access to the specified files. The lock is released when the returned AutoCloseable is closed. Until the lock is released, no other thread can access the files.
        Parameters:
        files - The files to lock.
        Returns:
        An AutoCloseable that releases the lock when closed.
      • lockAll

        QuietAutoCloseable lockAll()
        Locks access to the entire file system. The lock is released when the returned AutoCloseable is closed. Until the lock is released, no other thread can access the file system.
        Returns:
        An AutoCloseable that releases the lock when closed.