Skip to content

Commit

Permalink
GH-3294: Retry JdbcLock.unlock for TransDataAccEx
Browse files Browse the repository at this point in the history
Fixes #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**
  • Loading branch information
astrubel authored and artembilan committed Jun 9, 2020
1 parent 35d5555 commit 7ff0fdd
Showing 1 changed file with 14 additions and 8 deletions.
Expand Up @@ -229,14 +229,20 @@ public void unlock() {
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();
}
}
}

Expand Down

0 comments on commit 7ff0fdd

Please sign in to comment.