org.apache.activemq.broker
Interface Locker

All Superinterfaces:
Service
All Known Implementing Classes:
AbstractLocker, DefaultDatabaseLocker, LeaseDatabaseLocker, SharedFileLocker, TransactDatabaseLocker

public interface Locker
extends Service

Represents a lock service to ensure that a broker is the only master


Method Summary
 void configure(PersistenceAdapter persistenceAdapter)
          Optionally configure the locker with the persistence adapter currently used You can use persistence adapter configuration details like, data directory datasource, etc.
 boolean keepAlive()
          Used by a timer to keep alive the lock.
 void setFailIfLocked(boolean failIfLocked)
          Specify whether to fail immediately if the lock is already held.
 void setLockAcquireSleepInterval(long lockAcquireSleepInterval)
          set the delay interval in milliseconds between lock acquire attempts
 void setName(String name)
          Set the name of the lock to use.
 
Methods inherited from interface org.apache.activemq.Service
start, stop
 

Method Detail

keepAlive

boolean keepAlive()
                  throws IOException
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

Throws:
IOException

setLockAcquireSleepInterval

void setLockAcquireSleepInterval(long lockAcquireSleepInterval)
set the delay interval in milliseconds between lock acquire attempts

Parameters:
lockAcquireSleepInterval - the sleep interval in miliseconds

setName

void setName(String name)
Set the name of the lock to use.


setFailIfLocked

void setFailIfLocked(boolean failIfLocked)
Specify whether to fail immediately if the lock is already held. When set, the CustomLock must throw an IOException immediately upon detecting the lock is already held.

Parameters:
failIfLocked: - true => fail immediately if the lock is held; false => block until the lock can be obtained (default).

configure

void configure(PersistenceAdapter persistenceAdapter)
               throws IOException
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

Parameters:
persistenceAdapter -
Throws:
IOException


Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.