INT-4178: Retry CannotSerializeTransactionException in JdbcLockRegistry
JIRA: https://jira.spring.io/browse/INT-4178 The `JdbcLockRegistry` does not retry `CannotSerializeTransactionException` thrown by `DefaultLockRepository.acquire` which in turn causes `LockRegistryLeaderInitiator`s thread to get stuck. * catch `CannotSerializeTransactionException` on `DefaultLockRepository.acquire` and ignore it to ensure a retry **Cherry-pick to 4.3.x**
This commit is contained in:
committed by
Artem Bilan
parent
67332ad93a
commit
8198ff1861
@@ -26,6 +26,7 @@ import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.springframework.dao.CannotAcquireLockException;
|
||||
import org.springframework.dao.CannotSerializeTransactionException;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.integration.support.locks.DefaultLockRegistry;
|
||||
import org.springframework.integration.support.locks.ExpirableLockRegistry;
|
||||
@@ -43,6 +44,8 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Artem Bilan
|
||||
* @author Vedran Pavić
|
||||
*
|
||||
* @since 4.3
|
||||
*/
|
||||
public class JdbcLockRegistry implements ExpirableLockRegistry {
|
||||
@@ -120,6 +123,9 @@ public class JdbcLockRegistry implements ExpirableLockRegistry {
|
||||
}
|
||||
break;
|
||||
}
|
||||
catch (CannotSerializeTransactionException e) {
|
||||
// try again
|
||||
}
|
||||
catch (TransactionTimedOutException e) {
|
||||
// try again
|
||||
}
|
||||
@@ -154,6 +160,9 @@ public class JdbcLockRegistry implements ExpirableLockRegistry {
|
||||
}
|
||||
break;
|
||||
}
|
||||
catch (CannotSerializeTransactionException e) {
|
||||
// try again
|
||||
}
|
||||
catch (TransactionTimedOutException e) {
|
||||
// try again
|
||||
}
|
||||
@@ -198,6 +207,9 @@ public class JdbcLockRegistry implements ExpirableLockRegistry {
|
||||
}
|
||||
return acquired;
|
||||
}
|
||||
catch (CannotSerializeTransactionException e) {
|
||||
// try again
|
||||
}
|
||||
catch (TransactionTimedOutException e) {
|
||||
// try again
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user