activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1326610 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
Date Mon, 16 Apr 2012 13:28:52 GMT
Author: gtully
Date: Mon Apr 16 13:28:52 2012
New Revision: 1326610

URL: http://svn.apache.org/viewvc?rev=1326610&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3681 - make use of java.sql.Statement#setQueryTimeout
conditional on queryTimeout attribute > 0 so it can be disabled as it does not have universal
support, default value 10 seconds

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java?rev=1326610&r1=1326609&r2=1326610&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java
Mon Apr 16 13:28:52 2012
@@ -47,6 +47,7 @@ public class DefaultDatabaseLocker imple
     protected Connection connection;
     protected boolean stopping;
     protected Handler<Exception> exceptionHandler;
+    protected int queryTimeout = 10;
     
     public DefaultDatabaseLocker() {
     }
@@ -174,7 +175,9 @@ public class DefaultDatabaseLocker imple
         try {
             lockUpdateStatement = connection.prepareStatement(statements.getLockUpdateStatement());
             lockUpdateStatement.setLong(1, System.currentTimeMillis());
-            lockUpdateStatement.setQueryTimeout(10);
+            if (queryTimeout > 0) {
+                lockUpdateStatement.setQueryTimeout(queryTimeout);
+            }
             int rows = lockUpdateStatement.executeUpdate();
             if (rows == 1) {
                 result=true;
@@ -210,4 +213,11 @@ public class DefaultDatabaseLocker imple
         this.exceptionHandler = exceptionHandler;
     }
 
+    public int getQueryTimeout() {
+        return queryTimeout;
+    }
+
+    public void setQueryTimeout(int queryTimeout) {
+        this.queryTimeout = queryTimeout;
+    }
 }



Mime
View raw message