Interface LockRepository
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
DefaultLockRepository
Encapsulation of the SQL shunting that is needed for locks. A
JdbcLockRegistry
needs a reference to a spring-managed (transactional) client service, so this component
has to be declared as a bean.- Since:
- 4.3
- Author:
- Dave Syer, Alexandre Strubel, Artem Bilan
-
Method Summary
Modifier and TypeMethodDescriptionbooleanAcquire a lock for a key.voidclose()voidRemove a lock from this repository.voidRemove all the expired locks.booleanisAcquired(String lock) Check if a lock is held by this repository.booleanRenew the lease for a lock.
-
Method Details
-
isAcquired
Check if a lock is held by this repository.- Parameters:
lock- the lock to check.- Returns:
- acquired or not.
-
delete
Remove a lock from this repository.- Parameters:
lock- the lock to remove.
-
deleteExpired
void deleteExpired()Remove all the expired locks. -
acquire
Acquire a lock for a key.- Parameters:
lock- the key for lock to acquire.- Returns:
- acquired or not.
-
renew
Renew the lease for a lock.- Parameters:
lock- the lock to renew.- Returns:
- renewed or not.
-
close
void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-