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, Eddie Cho
-
Method Summary
Modifier and TypeMethodDescriptionbooleanDeprecated.since 7.0, we allow custom time-to-live valuebooleanAcquire a lock for a key with specific time-to-live valuevoidclose()booleanRemove a lock from this repository.voidRemove all the expired locks.booleanisAcquired(String lock) Check if a lock is held by this repository.booleanDeprecated.since 7.0, we allow custom time-to-live valuebooleanRenew the lease for a lock with specific time-to-live value
-
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.- Returns:
- deleted or not.
-
deleteExpired
void deleteExpired()Remove all the expired locks. -
acquire
Deprecated.since 7.0, we allow custom time-to-live valueAcquire a lock for a key.- Parameters:
lock- the key for lock to acquire.- Returns:
- acquired or not.
-
acquire
-
renew
Deprecated.since 7.0, we allow custom time-to-live valueRenew the lease for a lock.- Parameters:
lock- the lock to renew.- Returns:
- renewed or not.
-
renew
-
close
void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-