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 Object
- implements DatabaseLocker
Represents an exclusive lock on a database to avoid multiple brokers running
against the same logical database.
- Version:
- $Revision: $
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
lockAcquireSleepInterval
protected long lockAcquireSleepInterval
connection
protected Connection connection
stopping
protected boolean stopping
exceptionHandler
protected Handler<Exception> exceptionHandler
DefaultDatabaseLocker
public DefaultDatabaseLocker()
DefaultDatabaseLocker
public DefaultDatabaseLocker(JDBCPersistenceAdapter persistenceAdapter)
throws IOException
- Throws:
IOException
setPersistenceAdapter
public void setPersistenceAdapter(JDBCPersistenceAdapter adapter)
throws 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:
IOException
start
public void start()
throws Exception
- Specified by:
start
in interface Service
- Throws:
Exception
stop
public void stop()
throws Exception
- Specified by:
stop
in interface Service
- Throws:
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-2011 Apache Software Foundation. All Rights Reserved.