public class LeaseDatabaseLocker extends AbstractLocker
| Modifier and Type | Field and Description |
|---|---|
protected javax.sql.DataSource |
dataSource |
protected long |
diffFromCurrentTime |
protected java.lang.String |
leaseHolderId |
protected int |
maxAllowableDiffFromDBTime |
protected int |
queryTimeout |
protected Statements |
statements |
protected boolean |
stopping |
DEFAULT_LOCK_ACQUIRE_SLEEP_INTERVAL, failIfLocked, lockAcquireSleepInterval, name| Constructor and Description |
|---|
LeaseDatabaseLocker() |
| 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) |
java.lang.String |
getLeaseHolderId() |
long |
getLockAcquireSleepInterval() |
int |
getMaxAllowableDiffFromDBTime() |
int |
getQueryTimeout() |
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 |
setLockAcquireSleepInterval(long lockAcquireSleepInterval)
set the delay interval in milliseconds between lock acquire attempts
|
void |
setMaxAllowableDiffFromDBTime(int maxAllowableDiffFromDBTime) |
void |
setQueryTimeout(int queryTimeout) |
setFailIfLocked, setNameaddServiceListener, dispose, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start, stopprotected javax.sql.DataSource dataSource
protected Statements statements
protected boolean stopping
protected int maxAllowableDiffFromDBTime
protected long diffFromCurrentTime
protected java.lang.String leaseHolderId
protected int queryTimeout
public void configure(PersistenceAdapter adapter) throws java.io.IOException
Lockerjava.io.IOExceptionpublic void doStart()
throws java.lang.Exception
doStart in class ServiceSupportjava.lang.Exceptionprotected long initTimeDiff(java.sql.Connection connection)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void doStop(ServiceStopper stopper) throws java.lang.Exception
doStop in class ServiceSupportjava.lang.Exceptionpublic boolean keepAlive()
throws java.io.IOException
LockerkeepAlive in interface LockerkeepAlive in class AbstractLockerjava.io.IOExceptionpublic long getLockAcquireSleepInterval()
public void setLockAcquireSleepInterval(long lockAcquireSleepInterval)
LockersetLockAcquireSleepInterval in interface LockersetLockAcquireSleepInterval in class AbstractLockerlockAcquireSleepInterval - the sleep interval in milisecondspublic int getQueryTimeout()
public void setQueryTimeout(int queryTimeout)
public java.lang.String getLeaseHolderId()
public void setLeaseHolderId(java.lang.String leaseHolderId)
public int getMaxAllowableDiffFromDBTime()
public void setMaxAllowableDiffFromDBTime(int maxAllowableDiffFromDBTime)
Copyright © 2005-2013 Red Hat, Inc.. All Rights Reserved.