本文整理匯總了Java中liquibase.lockservice.DatabaseChangeLogLock類的典型用法代碼示例。如果您正苦於以下問題:Java DatabaseChangeLogLock類的具體用法?Java DatabaseChangeLogLock怎麽用?Java DatabaseChangeLogLock使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DatabaseChangeLogLock類屬於liquibase.lockservice包,在下文中一共展示了DatabaseChangeLogLock類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: lockIsStuck
import liquibase.lockservice.DatabaseChangeLogLock; //導入依賴的package包/類
private boolean lockIsStuck() throws LockException {
DatabaseChangeLogLock lock = getDatabaseChangeLogLock();
if (lock == null) {
return false;
}
Date lockGranted = lock.getLockGranted();
Date currentDate = new Date();
LOGGER.info(format(Messages.CURRENT_LOCK, lockGranted, lock.getLockedBy()));
LOGGER.info(format(Messages.CURRENT_DATE, currentDate));
return hasTimedOut(lockGranted, currentDate);
}
示例2: listLocks
import liquibase.lockservice.DatabaseChangeLogLock; //導入依賴的package包/類
@Override
public DatabaseChangeLogLock[] listLocks() throws LockException {
if (!lockDb) {
return new DatabaseChangeLogLock[0];
}
return super.listLocks();
}
示例3: reportLocks
import liquibase.lockservice.DatabaseChangeLogLock; //導入依賴的package包/類
public void reportLocks(PrintStream out) throws LiquibaseException {
DatabaseChangeLogLock[] locks = listLocks();
out.println("Database change log locks for " + getDatabase().getConnection().getConnectionUserName() + "@" + getDatabase().getConnection().getURL());
if (locks.length == 0) {
out.println(" - No locks");
}
for (DatabaseChangeLogLock lock : locks) {
out.println(" - " + lock.getLockedBy() + " at " + DateFormat.getDateTimeInstance().format(lock.getLockGranted()));
}
}
示例4: getDatabaseChangeLogLock
import liquibase.lockservice.DatabaseChangeLogLock; //導入依賴的package包/類
private DatabaseChangeLogLock getDatabaseChangeLogLock() throws LockException {
DatabaseChangeLogLock[] locks = listLocks();
return (locks.length > 0) ? locks[0] : null;
}
示例5: listLocks
import liquibase.lockservice.DatabaseChangeLogLock; //導入依賴的package包/類
/**
* Display change log lock information.
*/
public DatabaseChangeLogLock[] listLocks() throws LiquibaseException {
checkDatabaseChangeLogTable(false, null, null);
return LockService.getInstance(getDatabase()).listLocks();
}