Class ZkDistributedConfigSetLockFactory
- All Implemented Interfaces:
DistributedConfigSetLockFactory
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionZkDistributedConfigSetLockFactory(org.apache.solr.common.cloud.SolrZkClient zkClient, String rootPath) -
Method Summary
Modifier and TypeMethodDescriptioncreateLock(boolean isWriteLock, String configSetName) Create a new lock of the specified type (read or write) entering the "competition" for actually getting the lock for theconfigSetNameprotected DistributedLockdoCreateLock(boolean isWriteLock, String lockPath) protected StringBuilder
-
Constructor Details
-
ZkDistributedConfigSetLockFactory
public ZkDistributedConfigSetLockFactory(org.apache.solr.common.cloud.SolrZkClient zkClient, String rootPath)
-
-
Method Details
-
createLock
Description copied from interface:DistributedConfigSetLockFactoryCreate a new lock of the specified type (read or write) entering the "competition" for actually getting the lock for theconfigSetNameUpon return from this call, the lock has not been acquired but the it had entered the lock acquiring "competition", and the caller can decide to wait until the lock is granted by calling
DistributedLock.waitUntilAcquired().
Separating the lock creation from lock acquisition allows a more deterministic release of the locks when/if they can't be acquired.Locks at different paths are independent of each other, multiple
DistributedLockare therefore requested for a single operation and are packaged together and returned as anDistributedMultiLock, seeCollectionApiLockFactory.createCollectionApiLock(org.apache.solr.common.params.CollectionParams.LockLevel, java.lang.String, java.lang.String, java.lang.String)orConfigSetApiLockFactory.createConfigSetApiLock(java.lang.String, java.lang.String).- Specified by:
createLockin interfaceDistributedConfigSetLockFactory- Parameters:
isWriteLock-trueif requesting a write lock,falsefor a read lock.configSetName- the config set name, can never benull.- Returns:
- a lock instance that must be
DistributedLock.release()'ed in afinally, regardless of the lock having been acquired or not.
-
doCreateLock
-
getPathPrefix
-