public class DefaultDatabaseLocker extends AbstractLocker
| Modifier and Type | Field and Description |
|---|---|
protected java.sql.Connection |
connection |
protected javax.sql.DataSource |
dataSource |
protected Handler<java.lang.Exception> |
exceptionHandler |
protected java.sql.PreparedStatement |
lockCreateStatement |
protected java.sql.PreparedStatement |
lockUpdateStatement |
protected int |
queryTimeout |
protected Statements |
statements |
protected boolean |
stopping |
DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL, failIfLocked, lockAcquireSleepInterval, name| Constructor and Description |
|---|
DefaultDatabaseLocker() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(PersistenceAdapter adapter)
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) |
Handler |
getExceptionHandler() |
long |
getLockAcquireSleepInterval() |
int |
getQueryTimeout() |
boolean |
keepAlive()
Used by a timer to keep alive the lock.
|
void |
setExceptionHandler(Handler exceptionHandler) |
void |
setLockAcquireSleepInterval(long lockAcquireSleepInterval)
set the delay interval in milliseconds between lock acquire attempts
|
void |
setQueryTimeout(int queryTimeout) |
setFailIfLocked, setNameaddServiceListener, dispose, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start, stopprotected javax.sql.DataSource dataSource
protected Statements statements
protected volatile java.sql.PreparedStatement lockCreateStatement
protected volatile java.sql.PreparedStatement lockUpdateStatement
protected volatile java.sql.Connection connection
protected volatile boolean stopping
protected Handler<java.lang.Exception> exceptionHandler
protected int queryTimeout
public void configure(PersistenceAdapter adapter) throws java.io.IOException
Lockerjava.io.IOExceptionpublic void doStart()
throws java.lang.Exception
doStart in class ServiceSupportjava.lang.Exceptionpublic void doStop(ServiceStopper stopper) throws java.lang.Exception
doStop in class ServiceSupportjava.lang.Exceptionpublic boolean keepAlive()
throws java.io.IOException
LockerkeepAlive in interface LockerkeepAlive in class AbstractLockerjava.io.IOExceptionpublic long getLockAcquireSleepInterval()
public void setLockAcquireSleepInterval(long lockAcquireSleepInterval)
LockersetLockAcquireSleepInterval in interface LockersetLockAcquireSleepInterval in class AbstractLockerlockAcquireSleepInterval - the sleep interval in milisecondspublic Handler getExceptionHandler()
public void setExceptionHandler(Handler exceptionHandler)
public int getQueryTimeout()
public void setQueryTimeout(int queryTimeout)
Copyright © 2005-2013 Red Hat, Inc.. All Rights Reserved.