org.apache.activemq.broker
Class AbstractLocker

java.lang.Object
  extended by org.apache.activemq.util.ServiceSupport
      extended by org.apache.activemq.broker.AbstractLocker
All Implemented Interfaces:
Locker, Service
Direct Known Subclasses:
DefaultDatabaseLocker, LeaseDatabaseLocker, SharedFileLocker

public abstract class AbstractLocker
extends ServiceSupport
implements Locker


Field Summary
static long DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL
           
protected  boolean failIfLocked
           
protected  long lockAcquireSleepInterval
           
protected  String name
           
 
Constructor Summary
AbstractLocker()
           
 
Method Summary
 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 class org.apache.activemq.util.ServiceSupport
addServiceListener, dispose, doStart, doStop, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.activemq.broker.Locker
configure
 
Methods inherited from interface org.apache.activemq.Service
start, stop
 

Field Detail

DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL

public static final long DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL
See Also:
Constant Field Values

name

protected String name

failIfLocked

protected boolean failIfLocked

lockAcquireSleepInterval

protected long lockAcquireSleepInterval
Constructor Detail

AbstractLocker

public AbstractLocker()
Method Detail

keepAlive

public boolean keepAlive()
                  throws IOException
Description copied from interface: Locker
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

Specified by:
keepAlive in interface Locker
Throws:
IOException

setLockAcquireSleepInterval

public void setLockAcquireSleepInterval(long lockAcquireSleepInterval)
Description copied from interface: Locker
set the delay interval in milliseconds between lock acquire attempts

Specified by:
setLockAcquireSleepInterval in interface Locker
Parameters:
lockAcquireSleepInterval - the sleep interval in miliseconds

setName

public void setName(String name)
Description copied from interface: Locker
Set the name of the lock to use.

Specified by:
setName in interface Locker

setFailIfLocked

public void setFailIfLocked(boolean failIfLocked)
Description copied from interface: Locker
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.

Specified by:
setFailIfLocked in interface Locker


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