Package org.eclipse.aether.named
Interface NamedLockFactory
- All Known Implementing Classes:
FileLockNamedLockFactory,LocalReadWriteLockNamedLockFactory,LocalSemaphoreNamedLockFactory,NamedLockFactorySupport,NoopNamedLockFactory
public interface NamedLockFactory
A factory of
NamedLocks.-
Method Summary
Modifier and TypeMethodDescriptiongetLock(Collection<NamedLockKey> keys) Creates or reuses existingNamedLock.default NamedLockgetLock(NamedLockKey key) Creates or reuses existingNamedLock.default <E extends Throwable>
EonFailure(E failure) Method to notify factory about locking failure, to make it possible to provide more (factory specific) information about factory state when a locking operation failed.voidshutdown()Performs a clean shut down of the factory.
-
Method Details
-
getLock
Creates or reuses existingNamedLock. Returns instance MUST BE treated as "resource", best in try-with-resource block.- Parameters:
key- the lock key, must not benull.- Returns:
- named lock instance, never
null.
-
getLock
Creates or reuses existingNamedLock. Returns instance MUST BE treated as "resource", best in try-with-resource block.- Parameters:
keys- the lock keys, must not benulland must not be empty collection.- Returns:
- named lock instance, never
null. - Since:
- 2.0.0
-
shutdown
void shutdown()Performs a clean shut down of the factory. -
onFailure
Method to notify factory about locking failure, to make it possible to provide more (factory specific) information about factory state when a locking operation failed. Factory may alter provided failure or provide information via some other side effect (for example via logging).The default implementation merely does what happened before: adds no extra information.
- Since:
- 1.9.11
-