https://issues.apache.org/jira/browse/AMQ-3654 - tidy up logging and by default assume no adjust for out of sync system clocks

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1350029 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2012-06-13 21:43:21 +00:00
parent e32d6f6645
commit 6f2c998b4d
1 changed files with 8 additions and 4 deletions

View File

@ -44,7 +44,7 @@ public class LeaseDatabaseLocker implements DatabaseLocker {
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 implements DatabaseLocker {
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 implements DatabaseLocker {
}
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;
}