Package org.apache.activemq.store
Class SharedFileLocker
- java.lang.Object
-
- org.apache.activemq.util.ServiceSupport
-
- org.apache.activemq.broker.AbstractLocker
-
- org.apache.activemq.store.SharedFileLocker
-
public class SharedFileLocker extends AbstractLocker
Represents an exclusive lock on a database to avoid multiple brokers running against the same logical database.
-
-
Field Summary
Fields Modifier and Type Field Description static File
DEFAULT_DIRECTORY
protected File
directory
-
Fields inherited from class org.apache.activemq.broker.AbstractLocker
DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL, failIfLocked, lockable, lockAcquireSleepInterval, name
-
-
Constructor Summary
Constructors Constructor Description SharedFileLocker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.void
doStart()
void
doStop(ServiceStopper stopper)
File
getDirectory()
boolean
keepAlive()
Used by a timer to keep alive the lock.void
setDirectory(File directory)
-
Methods inherited from class org.apache.activemq.broker.AbstractLocker
getLockAcquireSleepInterval, setFailIfLocked, setLockable, setLockAcquireSleepInterval, setName
-
Methods inherited from class org.apache.activemq.util.ServiceSupport
addServiceListener, dispose, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start, stop
-
-
-
-
Method Detail
-
doStart
public void doStart() throws Exception
- Specified by:
doStart
in classServiceSupport
- Throws:
Exception
-
keepAlive
public boolean keepAlive()
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 interfaceLocker
- Overrides:
keepAlive
in classAbstractLocker
-
doStop
public void doStop(ServiceStopper stopper) throws Exception
- Specified by:
doStop
in classServiceSupport
- Throws:
Exception
-
getDirectory
public File getDirectory()
-
setDirectory
public void setDirectory(File directory)
-
configure
public void configure(PersistenceAdapter persistenceAdapter) throws IOException
Description copied from interface:Locker
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- Throws:
IOException
-
-