You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2012/06/13 23:43:21 UTC

svn commit: r1350029 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java

Author: gtully
Date: Wed Jun 13 21:43:21 2012
New Revision: 1350029

URL: http://svn.apache.org/viewvc?rev=1350029&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3654 - tidy up logging and by default assume no adjust for out of sync system clocks

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

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java?rev=1350029&r1=1350028&r2=1350029&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/LeaseDatabaseLocker.java Wed Jun 13 21:43:21 2012
@@ -44,7 +44,7 @@ public class LeaseDatabaseLocker impleme
     protected long lockAcquireSleepInterval = DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL;
 
     protected boolean stopping;
-    protected int maxAllowableDiffFromDBTime = 2000;
+    protected int maxAllowableDiffFromDBTime = 0;
     protected long diffFromCurrentTime = Long.MAX_VALUE;
     protected String leaseHolderId;
     protected int queryTimeout = -1;
@@ -60,7 +60,7 @@ public class LeaseDatabaseLocker impleme
     public void start() throws Exception {
         stopping = false;
 
-        LOG.info(getLeaseHolderId() + " attempting to acquire the exclusive lease to become the Master broker");
+        LOG.info(getLeaseHolderId() + " attempting to acquire exclusive lease to become the Master broker");
         String sql = statements.getLeaseObtainStatement();
         LOG.debug(getLeaseHolderId() + " locking Query is "+sql);
 
@@ -150,8 +150,12 @@ public class LeaseDatabaseLocker impleme
     }
 
     protected long initTimeDiff(Connection connection) throws SQLException {
-        if (maxAllowableDiffFromDBTime > 0 && Long.MAX_VALUE == diffFromCurrentTime) {
-            diffFromCurrentTime = determineTimeDifference(connection);
+        if (Long.MAX_VALUE == diffFromCurrentTime) {
+            if (maxAllowableDiffFromDBTime > 0) {
+                diffFromCurrentTime = determineTimeDifference(connection);
+            } else {
+                diffFromCurrentTime = 0l;
+            }
         }
         return diffFromCurrentTime;
     }