Package 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.AbstractJDBCLocker
org.apache.activemq.store.jdbc.LeaseDatabaseLocker
- All Implemented Interfaces:
Locker,org.apache.activemq.Service
Represents an exclusive lease on a database to avoid multiple brokers running
against the same logical database.
-
Field Summary
FieldsFields inherited from class org.apache.activemq.store.jdbc.AbstractJDBCLocker
createTablesOnStartup, dataSource, jdbcAdapter, queryTimeoutFields inherited from class org.apache.activemq.broker.AbstractLocker
DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL, failIfLocked, lockable, lockAcquireSleepInterval, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longdetermineTimeDifference(Connection connection) voiddoStart()voiddoStop(ServiceStopper stopper) intprotected longinitTimeDiff(Connection connection) booleanbooleanvoidsetHandleStartException(boolean handleStartException) voidsetLeaseHolderId(String leaseHolderId) voidsetMaxAllowableDiffFromDBTime(int maxAllowableDiffFromDBTime) toString()Methods inherited from class org.apache.activemq.store.jdbc.AbstractJDBCLocker
close, close, configure, getConnection, getQueryTimeout, getStatements, preStart, setCreateTablesOnStartup, setDataSource, setQueryTimeout, setQueryTimeout, setStatementsMethods inherited from class org.apache.activemq.broker.AbstractLocker
getLockAcquireSleepInterval, setFailIfLocked, setLockable, setLockAcquireSleepInterval, setNameMethods inherited from class org.apache.activemq.util.ServiceSupport
addServiceListener, dispose, isStarted, isStopped, isStopping, postStop, removeServiceListener, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.activemq.Service
start, stop
-
Field Details
-
maxAllowableDiffFromDBTime
protected int maxAllowableDiffFromDBTime -
diffFromCurrentTime
protected long diffFromCurrentTime -
leaseHolderId
-
handleStartException
protected boolean handleStartException
-
-
Constructor Details
-
LeaseDatabaseLocker
public LeaseDatabaseLocker()
-
-
Method Details
-
doStart
- Specified by:
doStartin classServiceSupport- Throws:
Exception
-
initTimeDiff
- Throws:
SQLException
-
determineTimeDifference
- Throws:
SQLException
-
doStop
- Specified by:
doStopin classServiceSupport- Throws:
Exception
-
keepAlive
- Specified by:
keepAlivein interfaceLocker- Overrides:
keepAlivein classAbstractLocker- Throws:
IOException
-
getLeaseHolderId
-
setLeaseHolderId
-
getMaxAllowableDiffFromDBTime
public int getMaxAllowableDiffFromDBTime() -
setMaxAllowableDiffFromDBTime
public void setMaxAllowableDiffFromDBTime(int maxAllowableDiffFromDBTime) -
isHandleStartException
public boolean isHandleStartException() -
setHandleStartException
public void setHandleStartException(boolean handleStartException) -
toString
-