Package org.apache.activemq.broker
Interface Locker
- All Superinterfaces:
org.apache.activemq.Service
- All Known Implementing Classes:
AbstractLocker,SharedFileLocker
public interface Locker
extends org.apache.activemq.Service
Represents a lock service to ensure that a broker is the only master
-
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(PersistenceAdapter persistenceAdapter) 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 lockerbooleanUsed by a timer to keep alive the lock.voidsetFailIfLocked(boolean failIfLocked) Specify whether to fail immediately if the lock is already held.voidsetLockable(LockableServiceSupport lockable) A reference to what is lockedvoidsetLockAcquireSleepInterval(long lockAcquireSleepInterval) set the delay interval in milliseconds between lock acquire attemptsvoidSet the name of the lock to use.Methods inherited from interface org.apache.activemq.Service
start, stop
-
Method Details
-
keepAlive
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
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).
-
setLockable
A reference to what is locked -
configure
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
-