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.LockRegistry,org.springframework.integration.support.locks.RenewableLockRegistry
public class JdbcLockRegistry
extends Object
implements org.springframework.integration.support.locks.ExpirableLockRegistry, org.springframework.integration.support.locks.RenewableLockRegistry
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
-
Constructor Summary
ConstructorsConstructorDescriptionJdbcLockRegistry(LockRepository client) Construct an instance based on the providedLockRepository. -
Method Summary
Modifier and TypeMethodDescriptionvoidexpireUnusedOlderThan(long age) voidvoidsetCacheCapacity(int cacheCapacity) Set the capacity of cached locks.voidsetIdleBetweenTries(Duration idleBetweenTries) Specify a @link Duration} to sleep between lock record insert/update attempts.
-
Constructor Details
-
JdbcLockRegistry
Construct an instance based on the providedLockRepository.- Parameters:
client- theLockRepositoryto rely on.
-
-
Method Details
-
setIdleBetweenTries
Specify a @link Duration} to sleep between lock record insert/update attempts. Defaults to 100 milliseconds.- Parameters:
idleBetweenTries- theDurationto sleep between insert/update attempts.- Since:
- 5.1.8
-
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
-
expireUnusedOlderThan
public void expireUnusedOlderThan(long age) - Specified by:
expireUnusedOlderThanin interfaceorg.springframework.integration.support.locks.ExpirableLockRegistry
-
renewLock
- Specified by:
renewLockin interfaceorg.springframework.integration.support.locks.RenewableLockRegistry
-