In what version(s) of Spring Integration are you seeing this issue?
spring-integration-jdbc 6.5.9
Describe the bug
JdbcLocks are not unique anymore. With spring-integration-jdbc 6.5.9 DefaultLockRegistry is used in some cases. This automatically results in non-uniqueness of the locks (delegates) which in general even contradicts the documented behavior.
To Reproduce
Obtain JdbcLock and tryLock for 2 different keys (e.g. "0" and "641").
Expected behavior
As documented in the JdbcLockRegistry class:
"... An {@link ExpirableLockRegistry} using a shared database to co-ordinate the locks. Provides the same semantics as the {@link org.springframework.integration.support.locks.DefaultLockRegistry}, but the locks taken will be global, as long as the underlying database supports the "serializable" isolation level in its transactions."
This change is also backward incompatible. Prior version 6.5.9 locks were not overlapping (e.g. the code below would work).
Sample
public static void main(String[] args) throws InterruptedException, ExecutionException {
JdbcLockRegistry registry = new JdbcLockRegistry(...);
ExecutorService executor = Executors.newSingleThreadExecutor();
assert registry.obtain("0").tryLock();
executor.submit(() -> {
assert registry.obtain("641").tryLock() : "should be able to lock";
}).get();
}
In what version(s) of Spring Integration are you seeing this issue?
spring-integration-jdbc 6.5.9
Describe the bug
JdbcLocks are not unique anymore. With spring-integration-jdbc 6.5.9 DefaultLockRegistry is used in some cases. This automatically results in non-uniqueness of the locks (delegates) which in general even contradicts the documented behavior.
To Reproduce
Obtain JdbcLock and tryLock for 2 different keys (e.g. "0" and "641").
Expected behavior
As documented in the JdbcLockRegistry class:
"... An {@link ExpirableLockRegistry} using a shared database to co-ordinate the locks. Provides the same semantics as the {@link org.springframework.integration.support.locks.DefaultLockRegistry}, but the locks taken will be global, as long as the underlying database supports the "serializable" isolation level in its transactions."
This change is also backward incompatible. Prior version 6.5.9 locks were not overlapping (e.g. the code below would work).
Sample