diff --git a/build.gradle b/build.gradle index 239ea08..12a9c1f 100644 --- a/build.gradle +++ b/build.gradle @@ -95,6 +95,7 @@ dependencyManagement { mavenBom "org.springframework.integration:spring-integration-bom:$springIntegrationVersion" mavenBom "com.fasterxml.jackson:jackson-bom:$jacksonVersion" mavenBom "org.junit:junit-bom:$junitVersion" + mavenBom "org.apache.logging.log4j:log4j-bom:$log4jVersion" } } @@ -137,8 +138,10 @@ dependencies { } testImplementation 'org.junit.jupiter:junit-jupiter-api' - testRuntimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion" - testRuntimeOnly "org.apache.logging.log4j:log4j-jcl:$log4jVersion" + testRuntimeOnly 'org.apache.logging.log4j:log4j-core' + testRuntimeOnly 'org.apache.logging.log4j:log4j-jcl' + testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl' + testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' } diff --git a/src/main/java/org/springframework/integration/aws/lock/DynamoDbLockRegistry.java b/src/main/java/org/springframework/integration/aws/lock/DynamoDbLockRegistry.java index b9b5c7c..f3c14a6 100644 --- a/src/main/java/org/springframework/integration/aws/lock/DynamoDbLockRegistry.java +++ b/src/main/java/org/springframework/integration/aws/lock/DynamoDbLockRegistry.java @@ -199,7 +199,7 @@ public class DynamoDbLockRegistry implements ExpirableLockRegistry, Initializing } /** - * Specify a period in milliseconds how often send locks renewal requests called heartbeat. + * Specify a period in seconds how often send locks renewal requests called heartbeat. * When the value is less than or equal to {@code 0}, the heartbeat is disabled. * @param heartbeatPeriod the heartbeat period for background thread to renew locks in DB */ @@ -502,8 +502,9 @@ public class DynamoDbLockRegistry implements ExpirableLockRegistry, Initializing return false; } - long additionalTimeToWait = Math - .max(TimeUnit.MILLISECONDS.convert(time, unit) - System.currentTimeMillis() + start, 0L); + long additionalTimeToWait = + TimeUnit.MILLISECONDS.convert(time, unit) + - System.currentTimeMillis() + start - DynamoDbLockRegistry.this.leaseDuration; this.acquireLockOptionsBuilder.withAdditionalTimeToWaitForLock(additionalTimeToWait);