public class DefaultDatabaseLocker extends AbstractJDBCLocker
Modifier and Type | Field and Description |
---|---|
protected java.sql.Connection |
connection |
protected Handler<java.lang.Exception> |
exceptionHandler |
protected java.sql.PreparedStatement |
lockCreateStatement |
protected java.sql.PreparedStatement |
lockUpdateStatement |
createTablesOnStartup, dataSource, jdbcAdapter, queryTimeout
DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL, failIfLocked, lockable, lockAcquireSleepInterval, name
Constructor and Description |
---|
DefaultDatabaseLocker() |
Modifier and Type | Method and Description |
---|---|
void |
doStart() |
void |
doStop(ServiceStopper stopper) |
Handler |
getExceptionHandler() |
long |
getLockAcquireSleepInterval() |
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
|
close, close, configure, getConnection, getQueryTimeout, getStatements, preStart, setCreateTablesOnStartup, setDataSource, setQueryTimeout, setQueryTimeout, setStatements
setFailIfLocked, setLockable, setName
addServiceListener, dispose, isStarted, isStopped, isStopping, postStop, removeServiceListener, start, stop
protected volatile java.sql.PreparedStatement lockCreateStatement
protected volatile java.sql.PreparedStatement lockUpdateStatement
protected volatile java.sql.Connection connection
protected Handler<java.lang.Exception> exceptionHandler
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()
getLockAcquireSleepInterval
in class AbstractLocker
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)
Copyright © 2005-2014 Red Hat, Inc.. All Rights Reserved.