Package liquibase.lockservice
Class StandardLockService
- java.lang.Object
-
- liquibase.lockservice.StandardLockService
-
- All Implemented Interfaces:
LockService,PrioritizedService
- Direct Known Subclasses:
LockServiceImpl
public class StandardLockService extends Object implements LockService
-
-
Field Summary
Fields Modifier and Type Field Description protected LongchangeLogLockPollRateprotected LongchangeLogLockRecheckTimeprotected static ResourceBundlecoreBundleprotected Databasedatabaseprotected booleanhasChangeLogLockprotected BooleanhasDatabaseChangeLogLockTableprotected booleanisDatabaseChangeLogLockTableInitializedprotected ObjectQuotingStrategyquotingStrategyprotected SecureRandomrandom-
Fields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description StandardLockService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacquireLock()voiddestroy()voidforceReleaseLock()Releases whatever locks are on the database change log tableprotected LonggetChangeLogLockRecheckTime()protected LonggetChangeLogLockWaitTime()intgetPriority()booleanhasChangeLogLock()voidinit()protected booleanisDatabaseChangeLogLockTableCreated()protected booleanisDatabaseChangeLogLockTableCreated(boolean forceRecheck)Check whether the databasechangeloglock table exists in the database.booleanisDatabaseChangeLogLockTableInitialized(boolean tableJustCreated)protected booleanisDatabaseChangeLogLockTableInitialized(boolean tableJustCreated, boolean forceRecheck)Determine whether the databasechangeloglock table has been initialized.DatabaseChangeLogLock[]listLocks()voidreleaseLock()voidreset()Clears information the lock handler knows about the tables.voidsetChangeLogLockRecheckTime(long changeLogLockRecheckTime)voidsetChangeLogLockWaitTime(long changeLogLockWaitTime)voidsetDatabase(Database database)booleansupports(Database database)voidwaitForLock()
-
-
-
Field Detail
-
coreBundle
protected static final ResourceBundle coreBundle
-
database
protected Database database
-
hasChangeLogLock
protected boolean hasChangeLogLock
-
changeLogLockPollRate
protected Long changeLogLockPollRate
-
changeLogLockRecheckTime
protected Long changeLogLockRecheckTime
-
hasDatabaseChangeLogLockTable
protected Boolean hasDatabaseChangeLogLockTable
-
isDatabaseChangeLogLockTableInitialized
protected boolean isDatabaseChangeLogLockTableInitialized
-
quotingStrategy
protected ObjectQuotingStrategy quotingStrategy
-
random
protected final SecureRandom random
-
-
Method Detail
-
getPriority
public int getPriority()
- Specified by:
getPriorityin interfacePrioritizedService
-
supports
public boolean supports(Database database)
- Specified by:
supportsin interfaceLockService
-
setDatabase
public void setDatabase(Database database)
- Specified by:
setDatabasein interfaceLockService
-
getChangeLogLockWaitTime
protected Long getChangeLogLockWaitTime()
-
setChangeLogLockWaitTime
public void setChangeLogLockWaitTime(long changeLogLockWaitTime)
- Specified by:
setChangeLogLockWaitTimein interfaceLockService
-
getChangeLogLockRecheckTime
protected Long getChangeLogLockRecheckTime()
-
setChangeLogLockRecheckTime
public void setChangeLogLockRecheckTime(long changeLogLockRecheckTime)
- Specified by:
setChangeLogLockRecheckTimein interfaceLockService
-
init
public void init() throws DatabaseException- Specified by:
initin interfaceLockService- Throws:
DatabaseException
-
isDatabaseChangeLogLockTableInitialized
public boolean isDatabaseChangeLogLockTableInitialized(boolean tableJustCreated)
-
isDatabaseChangeLogLockTableInitialized
protected boolean isDatabaseChangeLogLockTableInitialized(boolean tableJustCreated, boolean forceRecheck)Determine whether the databasechangeloglock table has been initialized.- Parameters:
forceRecheck- if true, do not use any cached information, and recheck the actual database
-
hasChangeLogLock
public boolean hasChangeLogLock()
- Specified by:
hasChangeLogLockin interfaceLockService
-
isDatabaseChangeLogLockTableCreated
protected boolean isDatabaseChangeLogLockTableCreated(boolean forceRecheck)
Check whether the databasechangeloglock table exists in the database.- Parameters:
forceRecheck- if true, do not use any cached information and check the actual database
-
isDatabaseChangeLogLockTableCreated
protected boolean isDatabaseChangeLogLockTableCreated() throws DatabaseException- Throws:
DatabaseException
-
waitForLock
public void waitForLock() throws LockException- Specified by:
waitForLockin interfaceLockService- Throws:
LockException
-
acquireLock
public boolean acquireLock() throws LockException- Specified by:
acquireLockin interfaceLockService- Throws:
LockException
-
releaseLock
public void releaseLock() throws LockException- Specified by:
releaseLockin interfaceLockService- Throws:
LockException
-
listLocks
public DatabaseChangeLogLock[] listLocks() throws LockException
- Specified by:
listLocksin interfaceLockService- Throws:
LockException
-
forceReleaseLock
public void forceReleaseLock() throws LockException, DatabaseExceptionDescription copied from interface:LockServiceReleases whatever locks are on the database change log table- Specified by:
forceReleaseLockin interfaceLockService- Throws:
LockExceptionDatabaseException
-
reset
public void reset()
Description copied from interface:LockServiceClears information the lock handler knows about the tables. Should only be called by Liquibase internal calls- Specified by:
resetin interfaceLockService
-
destroy
public void destroy() throws DatabaseException- Specified by:
destroyin interfaceLockService- Throws:
DatabaseException
-
-