Package dev.getelements.elements.rt
Interface LockSetService
- All Known Implementing Classes:
WeakReferenceLockSetService
public interface LockSetService
Locks a set of objects based on their identity in a consistent and order ensuring no deadlocks when having to acquire
multiple locks.
-
Method Summary
Modifier and TypeMethodDescriptiongetPathReadMonitor
(Path path) Gets a singleMonitor
for the suppliedResourceId
(for reading).default Monitor
getPathReadMonitor
(Collection<Path> paths) getPathWriteMonitor
(Path path) Gets a singleMonitor
for the suppliedResourceId
(for writing).default Monitor
getPathWriteMonitor
(Collection<Path> paths) getResourceIdReadMonitor
(ResourceId resourceId) Gets a singleMonitor
for the suppliedResourceId
(for reading).default Monitor
getResourceIdReadMonitor
(SortedSet<ResourceId> resourceIds) Gets aMonitor
which will lock all resources in theResourceId
instances for read operations.getResourceIdWriteMonitor
(ResourceId resourceId) Gets a singleMonitor
for the suppliedResourceId
(for writing).default Monitor
getResourceIdWriteMonitor
(SortedSet<ResourceId> resourceIds) Gets aMonitor
which will lock all resources in theResourceId
instances for write operations.void
Logs the status of theLockSetService
.
-
Method Details
-
logStatus
void logStatus()Logs the status of theLockSetService
. -
getPathReadMonitor
-
getPathWriteMonitor
-
getPathReadMonitor
Gets a singleMonitor
for the suppliedResourceId
(for reading). When requesting aPath
with aPath.WILDCARD
orPath.WILDCARD_RECURSIVE
component, this will essentially acquire all monitors for matching paths. -
getPathWriteMonitor
Gets a singleMonitor
for the suppliedResourceId
(for writing). When requesting aPath
with aPath.WILDCARD
orPath.WILDCARD_RECURSIVE
component, this will essentially acquire all monitors for matching paths. -
getResourceIdReadMonitor
Gets aMonitor
which will lock all resources in theResourceId
instances for read operations.- Parameters:
resourceIds
- a collection ofResourceId
instances- Returns:
- an instance of
Monitor
which aggregates locks across all requested resources.
-
getResourceIdWriteMonitor
Gets aMonitor
which will lock all resources in theResourceId
instances for write operations.- Parameters:
resourceIds
- a collection ofResourceId
instances- Returns:
- an instance of
Monitor
which aggregates locks across all requested resources.
-
getResourceIdReadMonitor
Gets a singleMonitor
for the suppliedResourceId
(for reading).- Parameters:
resourceId
- theResourceId
- Returns:
- the
Monitor
locking thoseResourceId
instances
-
getResourceIdWriteMonitor
Gets a singleMonitor
for the suppliedResourceId
(for writing).- Parameters:
resourceId
- theResourceId
- Returns:
- the
Monitor
locking thoseResourceId
instances
-