org.apache.activemq.store.jdbc
Class DefaultDatabaseLocker

java.lang.Object
  extended by org.apache.activemq.store.jdbc.DefaultDatabaseLocker
All Implemented Interfaces:
Service, DatabaseLocker

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: $

Field Summary
static long DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL
           
 
Constructor Summary
DefaultDatabaseLocker(DataSource dataSource, Statements statements)
           
DefaultDatabaseLocker(JDBCPersistenceAdapter persistenceAdapter)
           
 
Method Summary
 Handler getExceptionHandler()
           
 long getLockAcquireSleepInterval()
           
 boolean keepAlive()
          Used by a timer to keep alive the lock.
 void setExceptionHandler(Handler exceptionHandler)
           
 void setLockAcquireSleepInterval(long lockAcquireSleepInterval)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL

public static final long DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL
See Also:
Constant Field Values
Constructor Detail

DefaultDatabaseLocker

public DefaultDatabaseLocker(JDBCPersistenceAdapter persistenceAdapter)
                      throws IOException
Throws:
IOException

DefaultDatabaseLocker

public DefaultDatabaseLocker(DataSource dataSource,
                             Statements statements)
Method Detail

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)

getExceptionHandler

public Handler getExceptionHandler()

setExceptionHandler

public void setExceptionHandler(Handler exceptionHandler)


Copyright © 2008. All Rights Reserved.