Package de.xima.fc.common.filesystem
Interface ISynchronizedFileSystem<FD>
-
- Type Parameters:
FD
- The type of the file descriptor.
- All Superinterfaces:
AutoCloseable
,ICommonFileSystem<FD>
public interface ISynchronizedFileSystem<FD> extends ICommonFileSystem<FD>
Afile 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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description QuietAutoCloseable
lock(FD file)
Locks access to the specified file.QuietAutoCloseable
lock(FD... files)
Locks access to the specified files.QuietAutoCloseable
lock(Iterable<FD> files)
Locks access to the specified files.QuietAutoCloseable
lockAll()
Locks access to the entire file system.-
Methods inherited from interface java.lang.AutoCloseable
close
-
Methods inherited from interface de.xima.fc.common.filesystem.ICommonFileSystem
copy, delete, exists, getFileLastModifiedAt, getFileLastModifiedBy, getFiles, getFileSize, hasPendingChanges, isOpen, listFolder, listFolderRecursively, makeFile, makeFolder, openFileInput, openFileInputMarkable, openFileOutput, refresh, refresh, rename, unwrap
-
-
-
-
Method Detail
-
lock
QuietAutoCloseable lock(FD file)
Locks access to the specified file. The lock is released when the returnedAutoCloseable
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 returnedAutoCloseable
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 returnedAutoCloseable
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 returnedAutoCloseable
is closed. Until the lock is released, no other thread can access the file system.- Returns:
- An
AutoCloseable
that releases the lock when closed.
-
-