Class JdbcLockRegistry
java.lang.Object
org.springframework.integration.jdbc.lock.JdbcLockRegistry
- All Implemented Interfaces:
org.springframework.integration.support.locks.ExpirableLockRegistry<org.springframework.integration.support.locks.DistributedLock>,org.springframework.integration.support.locks.LockRegistry<org.springframework.integration.support.locks.DistributedLock>,org.springframework.integration.support.locks.RenewableLockRegistry<org.springframework.integration.support.locks.DistributedLock>
public class JdbcLockRegistry
extends Object
implements org.springframework.integration.support.locks.ExpirableLockRegistry<org.springframework.integration.support.locks.DistributedLock>, org.springframework.integration.support.locks.RenewableLockRegistry<org.springframework.integration.support.locks.DistributedLock>
An
ExpirableLockRegistry using a shared database to co-ordinate the locks.
Provides the same semantics as the
DefaultLockRegistry, but the
locks taken will be global, as long as the underlying database supports the
"serializable" isolation level in its transactions.- Since:
- 4.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DurationDefault value for the time-to-live property. -
Constructor Summary
ConstructorsConstructorDescriptionJdbcLockRegistry(LockRepository client) Construct an instance based on the providedLockRepository.JdbcLockRegistry(LockRepository client, Duration expireAfter) Create a lock registry with the supplied lock expiration. -
Method Summary
Modifier and TypeMethodDescriptionvoidexpireUnusedOlderThan(long age) org.springframework.integration.support.locks.DistributedLockprotected StringvoidvoidvoidsetCacheCapacity(int cacheCapacity) Set the capacity of cached locks.voidsetIdleBetweenTries(Duration idleBetweenTries) Specify aDurationto sleep between lock record insert/update attempts.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.support.locks.LockRegistry
executeLocked, executeLocked, executeLocked, executeLockedMethods inherited from interface org.springframework.integration.support.locks.RenewableLockRegistry
setRenewalTaskScheduler
-
Field Details
-
DEFAULT_TTL
-
-
Constructor Details
-
JdbcLockRegistry
Construct an instance based on the providedLockRepository.- Parameters:
client- theLockRepositoryto rely on.
-
JdbcLockRegistry
Create a lock registry with the supplied lock expiration.- Parameters:
client- theLockRepositoryto rely on.expireAfter- The expiration inDuration.- Since:
- 7.0
-
-
Method Details
-
setIdleBetweenTries
-
setCacheCapacity
public void setCacheCapacity(int cacheCapacity) Set the capacity of cached locks.- Parameters:
cacheCapacity- The capacity of cached lock, (default 100_000).- Since:
- 5.5.6
-
obtain
- Specified by:
obtainin interfaceorg.springframework.integration.support.locks.LockRegistry<org.springframework.integration.support.locks.DistributedLock>
-
pathFor
-
expireUnusedOlderThan
public void expireUnusedOlderThan(long age) - Specified by:
expireUnusedOlderThanin interfaceorg.springframework.integration.support.locks.ExpirableLockRegistry<org.springframework.integration.support.locks.DistributedLock>
-
renewLock
- Specified by:
renewLockin interfaceorg.springframework.integration.support.locks.RenewableLockRegistry<org.springframework.integration.support.locks.DistributedLock>
-
renewLock
-