Class LockStoreImpl
java.lang.Object
org.aksw.commons.lock.db.impl.LockStoreImpl
File System based implementation of a
LockStore.
For each resource subject to locking a folder is created in the lock repository.
Each read/write lock is represented as a file which then links to a path that represents the owner.
Typically the owner-path is the folder where transaction resources are managed.- Author:
- Claus Stadler
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ResourceRepository<String> Root folder of the lock dbprotected StringThe owner of locks are usually transactionsprotected Stringprotected ResourceRepository<String> Mapping of resources to store folders which enables creation of lock files that are link to other folders that contain the data being lockedprotected SymbolicLinkStrategyprotected String -
Constructor Summary
ConstructorsConstructorDescriptionLockStoreImpl(SymbolicLinkStrategy symbolicLinkStrategy, ResourceRepository<String> lockRepo, ResourceRepository<String> storeRepo, Function<String, Path> ownerRepoFactory) -
Method Summary
Modifier and TypeMethodDescriptiongetLockByKey(Path<String> lockKey) getLockForResource(String resource) Get the API to manage read/write locks for a given resourceGet a stream of all existing resource locks The resulting stream should be weakly consistent (See invalid input: '{@link Files#list(java.nio.file.Path)). The result stream should always be used in a try-with-resources block in order to ensure release of resources.'
-
Field Details
-
readLockFilenamePattern
-
writeLockFilename
-
mgmtLockFilename
-
symbolicLinkStrategy
-
lockRepo
Root folder of the lock db -
ownerRepoFactory
-
storeRepo
Mapping of resources to store folders which enables creation of lock files that are link to other folders that contain the data being locked
-
-
Constructor Details
-
LockStoreImpl
public LockStoreImpl(SymbolicLinkStrategy symbolicLinkStrategy, ResourceRepository<String> lockRepo, ResourceRepository<String> storeRepo, Function<String, Path> ownerRepoFactory)
-
-
Method Details
-
getLockForResource
Description copied from interface:LockStoreGet the API to manage read/write locks for a given resource- Specified by:
getLockForResourcein interfaceLockStore<String[],String> - Parameters:
resource-- Returns:
-
getLockByKey
- Specified by:
getLockByKeyin interfaceLockStore<String[],String>
-
streamResourceLocks
Description copied from interface:LockStoreGet a stream of all existing resource locks The resulting stream should be weakly consistent (See invalid input: '{@link Files#list(java.nio.file.Path)). The result stream should always be used in a try-with-resources block in order to ensure release of resources.'- Specified by:
streamResourceLocksin interfaceLockStore<String[],String> - Returns:
- Throws:
IOException
-