org.apache.activemq.store.jdbc
Class LeaseDatabaseLocker
java.lang.Object
org.apache.activemq.util.ServiceSupport
org.apache.activemq.broker.AbstractLocker
org.apache.activemq.store.jdbc.LeaseDatabaseLocker
- All Implemented Interfaces:
- Locker, Service
public class LeaseDatabaseLocker
- extends AbstractLocker
Represents an exclusive lease on a database to avoid multiple brokers running
against the same logical database.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL
public static final long DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL
- See Also:
- Constant Field Values
dataSource
protected DataSource dataSource
statements
protected Statements statements
stopping
protected boolean stopping
maxAllowableDiffFromDBTime
protected int maxAllowableDiffFromDBTime
diffFromCurrentTime
protected long diffFromCurrentTime
leaseHolderId
protected String leaseHolderId
queryTimeout
protected int queryTimeout
LeaseDatabaseLocker
public LeaseDatabaseLocker()
configure
public void configure(PersistenceAdapter adapter)
throws IOException
- Description copied from interface:
Locker
- Optionally configure the locker with the persistence adapter currently used
You can use persistence adapter configuration details like, data directory
datasource, etc. to be used by the locker
- Throws:
IOException
doStart
public void doStart()
throws Exception
- Specified by:
doStart in class ServiceSupport
- Throws:
Exception
initTimeDiff
protected long initTimeDiff(Connection connection)
throws SQLException
- Throws:
SQLException
doStop
public void doStop(ServiceStopper stopper)
throws Exception
- Specified by:
doStop in class ServiceSupport
- Throws:
Exception
keepAlive
public boolean keepAlive()
throws IOException
- Description copied from interface:
Locker
- Used by a timer to keep alive the lock.
If the method returns false the broker should be terminated
if an exception is thrown, the lock state cannot be determined
- Specified by:
keepAlive in interface Locker- Overrides:
keepAlive in class AbstractLocker
- Throws:
IOException
getLockAcquireSleepInterval
public long getLockAcquireSleepInterval()
setLockAcquireSleepInterval
public void setLockAcquireSleepInterval(long lockAcquireSleepInterval)
- Description copied from interface:
Locker
- set the delay interval in milliseconds between lock acquire attempts
- Specified by:
setLockAcquireSleepInterval in interface Locker- Overrides:
setLockAcquireSleepInterval in class AbstractLocker
- Parameters:
lockAcquireSleepInterval - the sleep interval in miliseconds
getQueryTimeout
public int getQueryTimeout()
setQueryTimeout
public void setQueryTimeout(int queryTimeout)
getLeaseHolderId
public String getLeaseHolderId()
setLeaseHolderId
public void setLeaseHolderId(String leaseHolderId)
getMaxAllowableDiffFromDBTime
public int getMaxAllowableDiffFromDBTime()
setMaxAllowableDiffFromDBTime
public void setMaxAllowableDiffFromDBTime(int maxAllowableDiffFromDBTime)
Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.