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 TypeMethodDescriptionboolean
Acquire a lock for a key.void
close()
void
Remove a lock from this repository.void
Remove all the expired locks.boolean
isAcquired
(String lock) Check if a lock is held by this repository.boolean
Renew 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-