diff --git a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/JdbcLockRegistry.java b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/JdbcLockRegistry.java index 5277e0b8fbe..7c4636557eb 100644 --- a/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/JdbcLockRegistry.java +++ b/spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/JdbcLockRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ import org.springframework.integration.support.locks.ExpirableLockRegistry; import org.springframework.integration.support.locks.LockRegistry; import org.springframework.integration.util.UUIDConverter; +import org.springframework.transaction.TransactionTimedOutException; import org.springframework.util.Assert; /** @@ -46,6 +47,8 @@ * @author Vedran Pavic * @author Kai Zimmermann * @author Bartosz Rempuszewski + * @author Gary Russell + * @author Alexandre Strubel * * @since 4.3 */ @@ -164,6 +167,9 @@ public void lockInterruptibly() throws InterruptedException { catch (TransientDataAccessException e) { // try again } + catch (TransactionTimedOutException e) { + // try again + } catch (InterruptedException ie) { this.delegate.unlock(); Thread.currentThread().interrupt(); @@ -208,6 +214,9 @@ public boolean tryLock(long time, TimeUnit unit) throws InterruptedException { catch (TransientDataAccessException e) { // try again } + catch (TransactionTimedOutException e) { + // try again + } catch (Exception e) { this.delegate.unlock(); rethrowAsLockException(e);