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, setName
addServiceListener, dispose, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start, stop
protected 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
Locker
java.io.IOException
public void doStart() throws java.lang.Exception
doStart
in class ServiceSupport
java.lang.Exception
public void doStop(ServiceStopper stopper) throws java.lang.Exception
doStop
in class ServiceSupport
java.lang.Exception
public boolean keepAlive() throws java.io.IOException
Locker
keepAlive
in interface Locker
keepAlive
in class AbstractLocker
java.io.IOException
public long getLockAcquireSleepInterval()
public void setLockAcquireSleepInterval(long lockAcquireSleepInterval)
Locker
setLockAcquireSleepInterval
in interface Locker
setLockAcquireSleepInterval
in class AbstractLocker
lockAcquireSleepInterval
- 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.