You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ni...@apache.org on 2020/10/30 16:57:49 UTC

[activemq-artemis] 02/03: ARTEMIS-2941 Fixing query timeout value

This is an automated email from the ASF dual-hosted git repository.

nigrofranz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git

commit e4a2a20c228c5c46838494b5325274ff79ff0145
Author: franz1981 <ni...@gmail.com>
AuthorDate: Fri Oct 30 17:42:15 2020 +0100

    ARTEMIS-2941 Fixing query timeout value
---
 .../activemq/artemis/core/server/impl/jdbc/JdbcLeaseLock.java    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcLeaseLock.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcLeaseLock.java
index f1c789c..ba8c200 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcLeaseLock.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/jdbc/JdbcLeaseLock.java
@@ -77,10 +77,13 @@ final class JdbcLeaseLock implements LeaseLock {
       this.connectionProvider = connectionProvider;
       this.lockName = lockName;
       this.localExpirationTime = -1;
-      int expectedTimeout = (int) (queryTimeoutMillis > 0 ? TimeUnit.MILLISECONDS.toSeconds(queryTimeoutMillis) : -1);
+      int expectedTimeout = -1;
       if (queryTimeoutMillis >= 0) {
-         LOGGER.warn("queryTimeoutMillis is too low: it's suggested to configure a multi-seconds value. Disabling it because too low.");
-         expectedTimeout = -1;
+         expectedTimeout = (int) TimeUnit.MILLISECONDS.toSeconds(queryTimeoutMillis);
+         if (expectedTimeout <= 0) {
+            LOGGER.warn("queryTimeoutMillis is too low: it's suggested to configure a multi-seconds value. Disabling it because too low.");
+            expectedTimeout = -1;
+         }
       }
       this.queryTimeout = expectedTimeout;