Package org.apache.activemq.broker
Class AbstractLocker
java.lang.Object
org.apache.activemq.util.ServiceSupport
org.apache.activemq.broker.AbstractLocker
- All Implemented Interfaces:
Locker,org.apache.activemq.Service
- Direct Known Subclasses:
SharedFileLocker
public abstract class AbstractLocker
extends org.apache.activemq.util.ServiceSupport
implements Locker
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longprotected booleanprotected LockableServiceSupportprotected longprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongbooleanUsed by a timer to keep alive the lock.voidsetFailIfLocked(boolean failIfLocked) Specify whether to fail immediately if the lock is already held.voidsetLockable(LockableServiceSupport lockableServiceSupport) 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 class org.apache.activemq.util.ServiceSupport
addServiceListener, dispose, doStart, doStop, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.activemq.Service
start, stop
-
Field Details
-
DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL
public static final long DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL- See Also:
-
name
-
failIfLocked
protected boolean failIfLocked -
lockAcquireSleepInterval
protected long lockAcquireSleepInterval -
lockable
-
-
Constructor Details
-
AbstractLocker
public AbstractLocker()
-
-
Method Details
-
keepAlive
Description copied from interface:LockerUsed 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- Specified by:
keepAlivein interfaceLocker- Throws:
IOException
-
setLockAcquireSleepInterval
public void setLockAcquireSleepInterval(long lockAcquireSleepInterval) Description copied from interface:Lockerset the delay interval in milliseconds between lock acquire attempts- Specified by:
setLockAcquireSleepIntervalin interfaceLocker- Parameters:
lockAcquireSleepInterval- the sleep interval in miliseconds
-
getLockAcquireSleepInterval
public long getLockAcquireSleepInterval() -
setName
Description copied from interface:LockerSet the name of the lock to use. -
setFailIfLocked
public void setFailIfLocked(boolean failIfLocked) Description copied from interface:LockerSpecify 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.- Specified by:
setFailIfLockedin interfaceLocker- Parameters:
failIfLocked- true => fail immediately if the lock is held; false => block until the lock can be obtained (default).
-
setLockable
Description copied from interface:LockerA reference to what is locked- Specified by:
setLockablein interfaceLocker
-