public class LeaseDatabaseLocker extends AbstractJDBCLocker
Modifier and Type | Field and Description |
---|---|
protected long |
diffFromCurrentTime |
protected java.lang.String |
leaseHolderId |
protected int |
maxAllowableDiffFromDBTime |
createTablesOnStartup, dataSource, jdbcAdapter, queryTimeout
DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL, failIfLocked, lockable, lockAcquireSleepInterval, name
Constructor and Description |
---|
LeaseDatabaseLocker() |
Modifier and Type | Method and Description |
---|---|
protected long |
determineTimeDifference(java.sql.Connection connection) |
void |
doStart() |
void |
doStop(ServiceStopper stopper) |
java.lang.String |
getLeaseHolderId() |
int |
getMaxAllowableDiffFromDBTime() |
protected long |
initTimeDiff(java.sql.Connection connection) |
boolean |
keepAlive()
Used by a timer to keep alive the lock.
|
void |
setLeaseHolderId(java.lang.String leaseHolderId) |
void |
setMaxAllowableDiffFromDBTime(int maxAllowableDiffFromDBTime) |
java.lang.String |
toString() |
close, close, configure, getConnection, getQueryTimeout, getStatements, preStart, setCreateTablesOnStartup, setDataSource, setQueryTimeout, setQueryTimeout, setStatements
getLockAcquireSleepInterval, setFailIfLocked, setLockable, setLockAcquireSleepInterval, setName
addServiceListener, dispose, isStarted, isStopped, isStopping, postStop, removeServiceListener, start, stop
protected int maxAllowableDiffFromDBTime
protected long diffFromCurrentTime
protected java.lang.String leaseHolderId
public void doStart() throws java.lang.Exception
doStart
in class ServiceSupport
java.lang.Exception
protected long initTimeDiff(java.sql.Connection connection) throws java.sql.SQLException
java.sql.SQLException
protected long determineTimeDifference(java.sql.Connection connection) throws java.sql.SQLException
java.sql.SQLException
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 java.lang.String getLeaseHolderId()
public void setLeaseHolderId(java.lang.String leaseHolderId)
public int getMaxAllowableDiffFromDBTime()
public void setMaxAllowableDiffFromDBTime(int maxAllowableDiffFromDBTime)
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2005-2014 Red Hat, Inc.. All Rights Reserved.