public class DefaultDatabaseLocker extends Object implements DatabaseLocker
| Modifier and Type | Field and Description |
|---|---|
protected Connection |
connection |
protected DataSource |
dataSource |
static long |
DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL |
protected Handler<Exception> |
exceptionHandler |
protected long |
lockAcquireSleepInterval |
protected PreparedStatement |
lockCreateStatement |
protected PreparedStatement |
lockUpdateStatement |
protected int |
queryTimeout |
protected Statements |
statements |
protected boolean |
stopping |
| Constructor and Description |
|---|
DefaultDatabaseLocker() |
DefaultDatabaseLocker(JDBCPersistenceAdapter persistenceAdapter) |
| Modifier and Type | Method and Description |
|---|---|
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 |
setPersistenceAdapter(JDBCPersistenceAdapter adapter)
allow the injection of a jdbc persistence adapter
|
void |
setQueryTimeout(int queryTimeout) |
void |
start() |
void |
stop() |
public static final long DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL
protected DataSource dataSource
protected Statements statements
protected long lockAcquireSleepInterval
protected PreparedStatement lockCreateStatement
protected PreparedStatement lockUpdateStatement
protected Connection connection
protected boolean stopping
protected Handler<Exception> exceptionHandler
protected int queryTimeout
public DefaultDatabaseLocker()
public DefaultDatabaseLocker(JDBCPersistenceAdapter persistenceAdapter) throws IOException
IOExceptionpublic void setPersistenceAdapter(JDBCPersistenceAdapter adapter) throws IOException
DatabaseLockersetPersistenceAdapter in interface DatabaseLockeradapter - the persistence adapter to useIOExceptionpublic boolean keepAlive()
DatabaseLockerkeepAlive in interface DatabaseLockerpublic long getLockAcquireSleepInterval()
public void setLockAcquireSleepInterval(long lockAcquireSleepInterval)
DatabaseLockersetLockAcquireSleepInterval in interface DatabaseLockerlockAcquireSleepInterval - the sleep interval in milisecondspublic Handler getExceptionHandler()
public void setExceptionHandler(Handler exceptionHandler)
public int getQueryTimeout()
public void setQueryTimeout(int queryTimeout)
Copyright © 2005–2017. All rights reserved.