liquibase.exception.LockException Java Examples
The following examples show how to use
liquibase.exception.LockException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RecoveringLockService.java From multiapps-controller with Apache License 2.0 | 6 votes |
@Override public void waitForLock() throws LockException { LockException releaseLockException = null; LockException acquireLockException = null; for (int attempt = 0; attempt < changeLogLockAttempts; attempt++) { releaseLockException = attemptToReleaseLock(); if (releaseLockException != null) { LOGGER.warn(releaseLockException.getMessage(), releaseLockException); } acquireLockException = attemptToAcquireLock(); if (acquireLockException != null) { LOGGER.warn(acquireLockException.getMessage(), acquireLockException); } else { return; } } throw acquireLockException; }
Example #2
Source File: RecoveringLockService.java From multiapps-controller with Apache License 2.0 | 5 votes |
private LockException attemptToReleaseLock() { try { if (lockIsStuck()) { LOGGER.info(Messages.ATTEMPTING_TO_RELEASE_STUCK_LOCK); releaseLock(); } return null; } catch (LockException e) { return e; } }
Example #3
Source File: RecoveringLockService.java From multiapps-controller with Apache License 2.0 | 5 votes |
private LockException attemptToAcquireLock() { try { super.waitForLock(); return null; } catch (LockException e) { return e; } }
Example #4
Source File: RecoveringLockService.java From multiapps-controller with Apache License 2.0 | 5 votes |
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); }
Example #5
Source File: MetastoreLockService.java From liquibase-impala with Apache License 2.0 | 5 votes |
@Override public DatabaseChangeLogLock[] listLocks() throws LockException { if (!lockDb) { return new DatabaseChangeLogLock[0]; } return super.listLocks(); }
Example #6
Source File: ModelDBHibernateUtil.java From modeldb with Apache License 2.0 | 5 votes |
private static void createTablesLiquibaseMigration(MetadataSources metaDataSrc) throws LiquibaseException, SQLException, InterruptedException { // Get database connection try (Connection con = metaDataSrc.getServiceRegistry().getService(ConnectionProvider.class).getConnection()) { JdbcConnection jdbcCon = new JdbcConnection(con); // Overwrite default liquibase table names by custom GlobalConfiguration liquibaseConfiguration = LiquibaseConfiguration.getInstance().getConfiguration(GlobalConfiguration.class); liquibaseConfiguration.setDatabaseChangeLogLockWaitTime(1L); // Initialize Liquibase and run the update Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(jdbcCon); String rootPath = System.getProperty(ModelDBConstants.userDir); rootPath = rootPath + "\\src\\main\\resources\\liquibase\\db-changelog-1.0.xml"; Liquibase liquibase = new Liquibase(rootPath, new FileSystemResourceAccessor(), database); boolean liquibaseExecuted = false; while (!liquibaseExecuted) { try { liquibase.update(new Contexts(), new LabelExpression()); liquibaseExecuted = true; } catch (LockException ex) { LOGGER.warn( "ModelDBHibernateUtil createTablesLiquibaseMigration() getting LockException ", ex); releaseLiquibaseLock(metaDataSrc); } } } }
Example #7
Source File: RecoveringLockService.java From multiapps-controller with Apache License 2.0 | 4 votes |
private DatabaseChangeLogLock getDatabaseChangeLogLock() throws LockException { DatabaseChangeLogLock[] locks = listLocks(); return (locks.length > 0) ? locks[0] : null; }
Example #8
Source File: MetastoreLockService.java From liquibase-impala with Apache License 2.0 | 4 votes |
@Override public void waitForLock() throws LockException { if (lockDb) { super.waitForLock(); } }
Example #9
Source File: MetastoreLockService.java From liquibase-impala with Apache License 2.0 | 4 votes |
@Override public void forceReleaseLock() throws LockException, DatabaseException { if (lockDb) { super.forceReleaseLock(); } }
Example #10
Source File: DummyLockService.java From keycloak with Apache License 2.0 | 4 votes |
@Override public void waitForLock() throws LockException { }
Example #11
Source File: DummyLockService.java From keycloak with Apache License 2.0 | 4 votes |
@Override public void releaseLock() throws LockException { }