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 Long
changeLogLockPollRate
protected Long
changeLogLockRecheckTime
protected static ResourceBundle
coreBundle
protected Database
database
protected boolean
hasChangeLogLock
protected Boolean
hasDatabaseChangeLogLockTable
protected boolean
isDatabaseChangeLogLockTableInitialized
protected ObjectQuotingStrategy
quotingStrategy
protected SecureRandom
random
-
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 boolean
acquireLock()
void
destroy()
void
forceReleaseLock()
Releases whatever locks are on the database change log tableprotected Long
getChangeLogLockRecheckTime()
protected Long
getChangeLogLockWaitTime()
int
getPriority()
boolean
hasChangeLogLock()
void
init()
protected boolean
isDatabaseChangeLogLockTableCreated()
protected boolean
isDatabaseChangeLogLockTableCreated(boolean forceRecheck)
Check whether the databasechangeloglock table exists in the database.boolean
isDatabaseChangeLogLockTableInitialized(boolean tableJustCreated)
protected boolean
isDatabaseChangeLogLockTableInitialized(boolean tableJustCreated, boolean forceRecheck)
Determine whether the databasechangeloglock table has been initialized.DatabaseChangeLogLock[]
listLocks()
void
releaseLock()
void
reset()
Clears information the lock handler knows about the tables.void
setChangeLogLockRecheckTime(long changeLogLockRecheckTime)
void
setChangeLogLockWaitTime(long changeLogLockWaitTime)
void
setDatabase(Database database)
boolean
supports(Database database)
void
waitForLock()
-
-
-
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:
getPriority
in interfacePrioritizedService
-
supports
public boolean supports(Database database)
- Specified by:
supports
in interfaceLockService
-
setDatabase
public void setDatabase(Database database)
- Specified by:
setDatabase
in interfaceLockService
-
getChangeLogLockWaitTime
protected Long getChangeLogLockWaitTime()
-
setChangeLogLockWaitTime
public void setChangeLogLockWaitTime(long changeLogLockWaitTime)
- Specified by:
setChangeLogLockWaitTime
in interfaceLockService
-
getChangeLogLockRecheckTime
protected Long getChangeLogLockRecheckTime()
-
setChangeLogLockRecheckTime
public void setChangeLogLockRecheckTime(long changeLogLockRecheckTime)
- Specified by:
setChangeLogLockRecheckTime
in interfaceLockService
-
init
public void init() throws DatabaseException
- Specified by:
init
in 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:
hasChangeLogLock
in 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:
waitForLock
in interfaceLockService
- Throws:
LockException
-
acquireLock
public boolean acquireLock() throws LockException
- Specified by:
acquireLock
in interfaceLockService
- Throws:
LockException
-
releaseLock
public void releaseLock() throws LockException
- Specified by:
releaseLock
in interfaceLockService
- Throws:
LockException
-
listLocks
public DatabaseChangeLogLock[] listLocks() throws LockException
- Specified by:
listLocks
in interfaceLockService
- Throws:
LockException
-
forceReleaseLock
public void forceReleaseLock() throws LockException, DatabaseException
Description copied from interface:LockService
Releases whatever locks are on the database change log table- Specified by:
forceReleaseLock
in interfaceLockService
- Throws:
LockException
DatabaseException
-
reset
public void reset()
Description copied from interface:LockService
Clears information the lock handler knows about the tables. Should only be called by Liquibase internal calls- Specified by:
reset
in interfaceLockService
-
destroy
public void destroy() throws DatabaseException
- Specified by:
destroy
in interfaceLockService
- Throws:
DatabaseException
-
-