Skip to content

Commit

Permalink
GH-3307: Retry TransTimedEx in LockRepo.acquire
Browse files Browse the repository at this point in the history
Fixes #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 b0cd015)

# Conflicts:
#	spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/JdbcLockRegistry.java
  • Loading branch information
artembilan committed Jun 16, 2020
1 parent 415fb64 commit b4d9831
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -127,6 +127,9 @@ public void lock() {
catch (TransientDataAccessException e) {
// try again
}
catch (TransactionTimedOutException e) {
// try again
}
catch (InterruptedException e) {
/*
* This method must be uninterruptible so catch and ignore
Expand Down

0 comments on commit b4d9831

Please sign in to comment.