GH-3294: Retry JdbcLock.unlock for TransDataAccEx
Fixes https://github.com/spring-projects/spring-integration/issues/3294 A `DeadlockLoserDataAccessException` occurs at `JdbcLockRegistry$JdbcLock.unlock()` - better to retry like in the `lock()` **Cherry-pick to 5.3.x, 5.2.x, 5.1.x & 4.3.x**
This commit is contained in:
@@ -236,14 +236,20 @@ public class JdbcLockRegistry implements ExpirableLockRegistry {
|
||||
this.delegate.unlock();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.mutex.delete(this.path);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new DataAccessResourceFailureException("Failed to release mutex at " + this.path, e);
|
||||
}
|
||||
finally {
|
||||
this.delegate.unlock();
|
||||
while (true) {
|
||||
try {
|
||||
this.mutex.delete(this.path);
|
||||
return;
|
||||
}
|
||||
catch (TransientDataAccessException e) {
|
||||
// try again
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new DataAccessResourceFailureException("Failed to release mutex at " + this.path, e);
|
||||
}
|
||||
finally {
|
||||
this.delegate.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user