Record Class PathLock
java.lang.Object
java.lang.Record
org.cryptomator.frontend.fuse.locks.PathLock
- Record Components:
pathComponents- The path, split into path componentsparent- The corresponding path lock for the parent pathrwLock- The read-write-lock. We need to store a strong reference while in use, because LockManager works with weeak referenceslock- Either therwLock's read or its write lockdataLockSupplier- A supplier for a separate ReadWriteLock (notrwLock) to be used duringlockDataForReading()andlockDataForWriting()
- All Implemented Interfaces:
AutoCloseable
public record PathLock(@Unmodifiable List<String> pathComponents, @Nullable PathLock parent, ReadWriteLock rwLock, Lock lock, Supplier<ReadWriteLock> dataLockSupplier)
extends Record
implements AutoCloseable
A path lock, either for reading (shared) or writing (exclusive).
-
Constructor Summary
ConstructorsConstructorDescriptionPathLock(@Unmodifiable List<String> pathComponents, @Nullable PathLock parent, ReadWriteLock rwLock, Lock lock, Supplier<ReadWriteLock> dataLockSupplier) Creates an instance of aPathLockrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Returns the value of thedataLockSupplierrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.lock()Returns the value of thelockrecord component.@Nullable PathLockparent()Returns the value of theparentrecord component.Returns the value of thepathComponentsrecord component.rwLock()Returns the value of therwLockrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PathLock
public PathLock(@Unmodifiable List<String> pathComponents, @Nullable @Nullable PathLock parent, ReadWriteLock rwLock, Lock lock, Supplier<ReadWriteLock> dataLockSupplier) Creates an instance of aPathLockrecord class.- Parameters:
pathComponents- the value for thepathComponentsrecord componentparent- the value for theparentrecord componentrwLock- the value for therwLockrecord componentlock- the value for thelockrecord componentdataLockSupplier- the value for thedataLockSupplierrecord component
-
-
Method Details
-
lockDataForReading
-
lockDataForWriting
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
pathComponents
Returns the value of thepathComponentsrecord component.- Returns:
- the value of the
pathComponentsrecord component
-
parent
-
rwLock
-
lock
-
dataLockSupplier
Returns the value of thedataLockSupplierrecord component.- Returns:
- the value of the
dataLockSupplierrecord component
-