AMQ-4122 - add log warning if lease will expire due to mal configuration

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1450213 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2013-02-26 15:25:47 +00:00
parent 7e61d56ca2
commit ef1d254e34
3 changed files with 12 additions and 0 deletions

View File

@ -54,4 +54,5 @@ public interface Lockable {
*/ */
public void setLockKeepAlivePeriod(long lockKeepAlivePeriod); public void setLockKeepAlivePeriod(long lockKeepAlivePeriod);
long getLockKeepAlivePeriod();
} }

View File

@ -74,6 +74,11 @@ public abstract class LockableServiceSupport extends ServiceSupport implements L
this.lockKeepAlivePeriod = lockKeepAlivePeriod; this.lockKeepAlivePeriod = lockKeepAlivePeriod;
} }
@Override
public long getLockKeepAlivePeriod() {
return lockKeepAlivePeriod;
}
@Override @Override
public void preStart() throws Exception { public void preStart() throws Exception {
init(); init();

View File

@ -64,6 +64,12 @@ public class LeaseDatabaseLocker extends AbstractLocker {
public void doStart() throws Exception { public void doStart() throws Exception {
stopping = false; stopping = false;
if (lockAcquireSleepInterval < persistenceAdapter.getLockKeepAlivePeriod()) {
LOG.warn("Persistence adapter keep alive period: " + persistenceAdapter.getLockKeepAlivePeriod()
+ ", which renews the lease, is less than lockAcquireSleepInterval: " + lockAcquireSleepInterval
+ ", the lease duration. These values will allow the lease to expire.");
}
LOG.info(getLeaseHolderId() + " attempting to acquire exclusive lease to become the Master broker"); LOG.info(getLeaseHolderId() + " attempting to acquire exclusive lease to become the Master broker");
String sql = statements.getLeaseObtainStatement(); String sql = statements.getLeaseObtainStatement();
LOG.debug(getLeaseHolderId() + " locking Query is "+sql); LOG.debug(getLeaseHolderId() + " locking Query is "+sql);