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 singleMonitorfor the suppliedResourceId(for reading).default MonitorgetPathReadMonitor(Collection<Path> paths) getPathWriteMonitor(Path path) Gets a singleMonitorfor the suppliedResourceId(for writing).default MonitorgetPathWriteMonitor(Collection<Path> paths) getResourceIdReadMonitor(ResourceId resourceId) Gets a singleMonitorfor the suppliedResourceId(for reading).default MonitorgetResourceIdReadMonitor(SortedSet<ResourceId> resourceIds) Gets aMonitorwhich will lock all resources in theResourceIdinstances for read operations.getResourceIdWriteMonitor(ResourceId resourceId) Gets a singleMonitorfor the suppliedResourceId(for writing).default MonitorgetResourceIdWriteMonitor(SortedSet<ResourceId> resourceIds) Gets aMonitorwhich will lock all resources in theResourceIdinstances for write operations.voidLogs the status of theLockSetService.
-
Method Details
-
logStatus
void logStatus()Logs the status of theLockSetService. -
getPathReadMonitor
-
getPathWriteMonitor
-
getPathReadMonitor
Gets a singleMonitorfor the suppliedResourceId(for reading). When requesting aPathwith aPath.WILDCARDorPath.WILDCARD_RECURSIVEcomponent, this will essentially acquire all monitors for matching paths. -
getPathWriteMonitor
Gets a singleMonitorfor the suppliedResourceId(for writing). When requesting aPathwith aPath.WILDCARDorPath.WILDCARD_RECURSIVEcomponent, this will essentially acquire all monitors for matching paths. -
getResourceIdReadMonitor
Gets aMonitorwhich will lock all resources in theResourceIdinstances for read operations.- Parameters:
resourceIds- a collection ofResourceIdinstances- Returns:
- an instance of
Monitorwhich aggregates locks across all requested resources.
-
getResourceIdWriteMonitor
Gets aMonitorwhich will lock all resources in theResourceIdinstances for write operations.- Parameters:
resourceIds- a collection ofResourceIdinstances- Returns:
- an instance of
Monitorwhich aggregates locks across all requested resources.
-
getResourceIdReadMonitor
Gets a singleMonitorfor the suppliedResourceId(for reading).- Parameters:
resourceId- theResourceId- Returns:
- the
Monitorlocking thoseResourceIdinstances
-
getResourceIdWriteMonitor
Gets a singleMonitorfor the suppliedResourceId(for writing).- Parameters:
resourceId- theResourceId- Returns:
- the
Monitorlocking thoseResourceIdinstances
-