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
IOException
public void setPersistenceAdapter(JDBCPersistenceAdapter adapter) throws IOException
DatabaseLocker
setPersistenceAdapter
in interface DatabaseLocker
adapter
- the persistence adapter to useIOException
public boolean keepAlive()
DatabaseLocker
keepAlive
in interface DatabaseLocker
public long getLockAcquireSleepInterval()
public void setLockAcquireSleepInterval(long lockAcquireSleepInterval)
DatabaseLocker
setLockAcquireSleepInterval
in interface DatabaseLocker
lockAcquireSleepInterval
- the sleep interval in milisecondspublic Handler getExceptionHandler()
public void setExceptionHandler(Handler exceptionHandler)
public int getQueryTimeout()
public void setQueryTimeout(int queryTimeout)
Copyright © 2005–2014. All rights reserved.