GH-3307: Retry TransTimedEx in LockRepo.acquire

Fixes https://github.com/spring-projects/spring-integration/issues/3307

The `DefaultLockRepository.acquire()` is transactional method and
can fail with the `TransactionTimedOutException`.
When we call `JdbcLock.lock()`, we expect an attempt until we really obtain a lock.

* Treat a `TransactionTimedOutException` as a `TransientDataAccessException` and
therefore retry a locking attempt logic

**Cherry-pick to 5.3.x, 5.2.x & 4.3.x**

(cherry picked from commit b0cd0156c7)

# Conflicts:
#	spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/JdbcLockRegistry.java
This commit is contained in:
Artem Bilan
2020-06-16 12:27:40 -04:00
parent 415fb6465f
commit b4d9831d95

View File

@@ -127,6 +127,9 @@ public class JdbcLockRegistry implements ExpirableLockRegistry {
catch (TransientDataAccessException e) {
// try again
}
catch (TransactionTimedOutException e) {
// try again
}
catch (InterruptedException e) {
/*
* This method must be uninterruptible so catch and ignore