org.apache.activemq.store.jdbc
Class DefaultDatabaseLocker
java.lang.Object
org.apache.activemq.store.jdbc.DefaultDatabaseLocker
- All Implemented Interfaces:
- Service, DatabaseLocker
- Direct Known Subclasses:
- TransactDatabaseLocker
public class DefaultDatabaseLocker
- extends java.lang.Object
- implements DatabaseLocker
Represents an exclusive lock 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 javax.sql.DataSource dataSource
statements
protected Statements statements
lockAcquireSleepInterval
protected long lockAcquireSleepInterval
connection
protected java.sql.Connection connection
stopping
protected boolean stopping
exceptionHandler
protected Handler<java.lang.Exception> exceptionHandler
DefaultDatabaseLocker
public DefaultDatabaseLocker()
DefaultDatabaseLocker
public DefaultDatabaseLocker(JDBCPersistenceAdapter persistenceAdapter)
throws java.io.IOException
- Throws:
java.io.IOException
setPersistenceAdapter
public void setPersistenceAdapter(JDBCPersistenceAdapter adapter)
throws java.io.IOException
- Description copied from interface:
DatabaseLocker
- allow the injection of a jdbc persistence adapter
- Specified by:
setPersistenceAdapter
in interface DatabaseLocker
- Parameters:
adapter
- the persistence adapter to use
- Throws:
java.io.IOException
start
public void start()
throws java.lang.Exception
- Specified by:
start
in interface Service
- Throws:
java.lang.Exception
stop
public void stop()
throws java.lang.Exception
- Specified by:
stop
in interface Service
- Throws:
java.lang.Exception
keepAlive
public boolean keepAlive()
- Description copied from interface:
DatabaseLocker
- Used by a timer to keep alive the lock.
If the method returns false the broker should be terminated
- Specified by:
keepAlive
in interface DatabaseLocker
getLockAcquireSleepInterval
public long getLockAcquireSleepInterval()
setLockAcquireSleepInterval
public void setLockAcquireSleepInterval(long lockAcquireSleepInterval)
- Description copied from interface:
DatabaseLocker
- set the delay interval in milliseconds between lock acquire attempts
- Specified by:
setLockAcquireSleepInterval
in interface DatabaseLocker
- Parameters:
lockAcquireSleepInterval
- the sleep interval in miliseconds
getExceptionHandler
public Handler getExceptionHandler()
setExceptionHandler
public void setExceptionHandler(Handler exceptionHandler)
Copyright © 2005-2012. All Rights Reserved.