• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ExecutorService类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中liquibase.executor.ExecutorService的典型用法代码示例。如果您正苦于以下问题:Java ExecutorService类的具体用法?Java ExecutorService怎么用?Java ExecutorService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ExecutorService类属于liquibase.executor包,在下文中一共展示了ExecutorService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: tag

import liquibase.executor.ExecutorService; //导入依赖的package包/类
@Override
    public void tag(final String tagString) throws DatabaseException {
        Database database = getDatabase();
        Executor executor = ExecutorService.getInstance().getExecutor(database);
        try {
            int totalRows = ExecutorService.getInstance().getExecutor(database).queryForInt(new SelectFromDatabaseChangeLogStatement(new ColumnConfig().setName("COUNT(*)", true)));
            if (totalRows == 0) {
                ChangeSet emptyChangeSet = new ChangeSet(String.valueOf(new Date().getTime()), "liquibase", false, false, "liquibase-internal", null, null, getDatabase().getObjectQuotingStrategy(), null);
                this.setExecType(emptyChangeSet, ChangeSet.ExecType.EXECUTED);
            }

//            Timestamp lastExecutedDate = (Timestamp) this.getExecutor().queryForObject(createChangeToTagSQL(), Timestamp.class);
            executor.execute(new TagDatabaseStatement(tagString));
            getDatabase().commit();

            if (this.ranChangeSetList != null) {
                ranChangeSetList.get(ranChangeSetList.size() - 1).setTag(tagString);
            }
        } catch (Exception e) {
            throw new DatabaseException(e);
        }
    }
 
开发者ID:eselyavka,项目名称:liquibase-impala,代码行数:23,代码来源:HiveStandardChangeLogHistoryService.java


示例2: generateStatements

import liquibase.executor.ExecutorService; //导入依赖的package包/类
@Override
public SqlStatement[] generateStatements(final Database database)
{
	validateParameters();

	final Executor currentExecutor = ExecutorService.getInstance().getExecutor(database);

	if (startOrStop == START_OR_STOP.START)
	{
		startSuppressing(database, currentExecutor);
	}
	else if (startOrStop == START_OR_STOP.STOP)
	{
		stopSuppressing(database, currentExecutor);
	}
	else
	{
		throw new IllegalArgumentException("Unknown startOrStop value " + startOrStop.name());
	}

	return new SqlStatement[] {};
}
 
开发者ID:Jurrie,项目名称:liquibase-suppress-output,代码行数:23,代码来源:SuppressOutputChange.java


示例3: generateRollbackStatements

import liquibase.executor.ExecutorService; //导入依赖的package包/类
@Override
public SqlStatement[] generateRollbackStatements(final Database database) throws RollbackImpossibleException
{
	validateParameters();

	final Executor currentExecutor = ExecutorService.getInstance().getExecutor(database);

	if (startOrStop == START_OR_STOP.START)
	{
		stopSuppressing(database, currentExecutor);
	}
	else if (startOrStop == START_OR_STOP.STOP)
	{
		startSuppressing(database, currentExecutor);
	}
	else
	{
		throw new IllegalArgumentException("Unknown startOrStop value " + startOrStop.name());
	}

	return new SqlStatement[] {};
}
 
开发者ID:Jurrie,项目名称:liquibase-suppress-output,代码行数:23,代码来源:SuppressOutputChange.java


示例4: close

import liquibase.executor.ExecutorService; //导入依赖的package包/类
@Override
public void close() throws DatabaseException {

    // copy-paste from AbstractJdbcDatabase plus reflection to deal with private fields...

    ExecutorService.getInstance().clearExecutor(this);
    DatabaseConnection connection = getConnection();
    if (connection != null) {

        Boolean previousAutoCommit = previousAutoCommit();
        if (previousAutoCommit != null) {
            try {
                connection.setAutoCommit(previousAutoCommit);
            } catch (DatabaseException e) {
                LogFactory.getInstance().getLog().warning("Failed to restore the auto commit to " + previousAutoCommit);
                throw e;
            }
        }
        connection.close();
    }
}
 
开发者ID:bootique,项目名称:bootique-liquibase,代码行数:22,代码来源:DerbyDatabase.java


示例5: setup

import liquibase.executor.ExecutorService; //导入依赖的package包/类
@Before
public void setup() {
    System.setProperty(Configuration.LIQUIBASE_PASSWORD, "root");

    database = new MySQLDatabase();
    database.setLiquibaseSchemaName("testdb");
    DatabaseConnection conn = new MockDatabaseConnection("jdbc:mysql://[email protected]:3306/testdb",
            "[email protected]");
    database.setConnection(conn);
    ExecutorService.getInstance().setExecutor(database, new JdbcExecutor());

    PTOnlineSchemaChangeStatement.available = true;
    PTOnlineSchemaChangeStatement.perconaToolkitVersion = null;
    System.setProperty(Configuration.FAIL_IF_NO_PT, "false");
    System.setProperty(Configuration.NO_ALTER_SQL_DRY_MODE, "false");
    System.setProperty(Configuration.SKIP_CHANGES, "");

    setupChange(change);
}
 
开发者ID:adangel,项目名称:liquibase-percona,代码行数:20,代码来源:AbstractPerconaChangeTest.java


示例6: tag

import liquibase.executor.ExecutorService; //导入依赖的package包/类
/**
     * Tags the database changelog with the given string.
     */
    public void tag(String tagString) throws DatabaseException {
        Executor executor = ExecutorService.getInstance().getExecutor(this);
        try {
            int totalRows = ExecutorService.getInstance().getExecutor(this).queryForInt(new SelectFromDatabaseChangeLogStatement("COUNT(*)"));
            if (totalRows == 0) {
                ChangeSet emptyChangeSet = new ChangeSet(String.valueOf(new Date().getTime()), "liquibase", false, false, "liquibase-internal", null, null);
                this.markChangeSetExecStatus(emptyChangeSet, ChangeSet.ExecType.EXECUTED);
            }

//            Timestamp lastExecutedDate = (Timestamp) this.getExecutor().queryForObject(createChangeToTagSQL(), Timestamp.class);
            executor.execute(new TagDatabaseStatement(tagString));
            this.commit();

            getRanChangeSetList().get(getRanChangeSetList().size() - 1).setTag(tagString);
        } catch (Exception e) {
            throw new DatabaseException(e);
        }
    }
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:22,代码来源:AbstractDatabase.java


示例7: getViewDefinition

import liquibase.executor.ExecutorService; //导入依赖的package包/类
@Override
public String getViewDefinition(String schemaName, String viewName) throws DatabaseException {
    if (schemaName == null) {
        schemaName = convertRequestedSchemaToSchema(null);
    }
    List<String> defLines = (List<String>) ExecutorService.getInstance().getExecutor(this).queryForList(new GetViewDefinitionStatement(schemaName, viewName), String.class);
    StringBuffer sb = new StringBuffer();
    for (String defLine : defLines) {
        sb.append(defLine);
    }
    String definition = sb.toString();

    if (definition == null) {
        return null;
    }
    return CREATE_VIEW_AS_PATTERN.matcher(definition).replaceFirst("");
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:18,代码来源:MSSQLDatabase.java


示例8: check

import liquibase.executor.ExecutorService; //导入依赖的package包/类
public void check(Database database, DatabaseChangeLog changeLog, ChangeSet changeSet) throws PreconditionFailedException, PreconditionErrorException {
    DatabaseConnection connection = database.getConnection();
    try {
        String result = (String) ExecutorService.getInstance().getExecutor(database).queryForObject(new RawSqlStatement(getSql().replaceFirst(";$","")), String.class);
        if (result == null) {
            throw new PreconditionFailedException("No rows returned from SQL Precondition", changeLog, this);
        }

        if (!expectedResult.equals(result)) {
            throw new PreconditionFailedException("SQL Precondition failed.  Expected '"+expectedResult+"' got '"+result+"'", changeLog, this);
        }

    } catch (DatabaseException e) {
        throw new PreconditionErrorException(e, changeLog, this);
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:17,代码来源:SqlPrecondition.java


示例9: listLocks

import liquibase.executor.ExecutorService; //导入依赖的package包/类
public DatabaseChangeLogLock[] listLocks() throws LockException {
    try {
        if (!database.hasDatabaseChangeLogLockTable()) {
            return new DatabaseChangeLogLock[0];
        }

        List<DatabaseChangeLogLock> allLocks = new ArrayList<DatabaseChangeLogLock>();
        SqlStatement sqlStatement = new SelectFromDatabaseChangeLogLockStatement("ID", "LOCKED", "LOCKGRANTED", "LOCKEDBY");
        List<Map> rows = ExecutorService.getInstance().getExecutor(database).queryForList(sqlStatement);
        for (Map columnMap : rows) {
            Object lockedValue = columnMap.get("LOCKED");
            Boolean locked;
            if (lockedValue instanceof Number) {
                locked = ((Number) lockedValue).intValue() == 1;
            } else {
                locked = (Boolean) lockedValue;
            }
            if (locked != null && locked) {
                allLocks.add(new DatabaseChangeLogLock(((Number) columnMap.get("ID")).intValue(), (Date) columnMap.get("LOCKGRANTED"), (String) columnMap.get("LOCKEDBY")));
            }
        }
        return allLocks.toArray(new DatabaseChangeLogLock[allLocks.size()]);
    } catch (Exception e) {
        throw new LockException(e);
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:27,代码来源:LockService.java


示例10: readSequences

import liquibase.executor.ExecutorService; //导入依赖的package包/类
protected void readSequences(DatabaseSnapshot snapshot, String schema, DatabaseMetaData databaseMetaData)
		throws DatabaseException {
	Database database = snapshot.getDatabase();
	if (database.supportsSequences()) {
		updateListeners("Reading sequences for " + database.toString() + " ...");

		String convertedSchemaName = database.convertRequestedSchemaToSchema(schema);

		// noinspection unchecked
		List<String> sequenceNames = (List<String>) ExecutorService.getInstance().getExecutor(database)
				.queryForList(new SelectSequencesStatement(schema), String.class);

		if (sequenceNames != null) {
			for (String sequenceName : sequenceNames) {
				Sequence seq = new Sequence();
				seq.setName(sequenceName.trim());
				seq.setSchema(convertedSchemaName);

				snapshot.getSequences().add(seq);
			}
		}
	} else {
		updateListeners("Sequences not supported for " + database.toString() + " ...");
	}
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:26,代码来源:JdbcDatabaseSnapshotGenerator.java


示例11: readSequences

import liquibase.executor.ExecutorService; //导入依赖的package包/类
@Override
protected void readSequences(DatabaseSnapshot snapshot, String schema, DatabaseMetaData databaseMetaData) throws DatabaseException {
    Database database = snapshot.getDatabase();
    updateListeners("Reading sequences for " + database.toString() + " ...");

    String convertedSchemaName = database.convertRequestedSchemaToSchema(schema);

    if (database.supportsSequences()) {
        //noinspection unchecked
        List<String> sequenceNamess = (List<String>) ExecutorService.getInstance().getExecutor(database).queryForList(new SelectSequencesStatement(schema), String.class);


        for (String sequenceName : sequenceNamess) {
            Sequence seq = new Sequence();
            seq.setName(sequenceName.trim());
            seq.setName(convertedSchemaName);

            snapshot.getSequences().add(seq);
        }
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:22,代码来源:SQLiteDatabaseSnapshotGenerator.java


示例12: update

import liquibase.executor.ExecutorService; //导入依赖的package包/类
public void update(String contexts, Writer output) throws LiquibaseException {
    contexts = StringUtils.trimToNull(contexts);
    changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));

    Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);
    LoggingExecutor loggingExecutor = new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database);
    ExecutorService.getInstance().setExecutor(database, loggingExecutor);

    outputHeader("Update Database Script");

    LockService lockService = LockService.getInstance(database);
    lockService.waitForLock();

    try {

        update(contexts);

        output.flush();
    } catch (IOException e) {
        throw new LiquibaseException(e);
    } finally {
        lockService.releaseLock();
    }

    ExecutorService.getInstance().setExecutor(database, oldTemplate);
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:27,代码来源:Liquibase.java


示例13: rollback

import liquibase.executor.ExecutorService; //导入依赖的package包/类
public void rollback(int changesToRollback, String contexts, Writer output) throws LiquibaseException {
    contexts = StringUtils.trimToNull(contexts);
    changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));

    Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);
    ExecutorService.getInstance().setExecutor(database, new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database));

    outputHeader("Rollback " + changesToRollback + " Change(s) Script");

    rollback(changesToRollback, contexts);

    try {
        output.flush();
    } catch (IOException e) {
        throw new LiquibaseException(e);
    }
    ExecutorService.getInstance().setExecutor(database, oldTemplate);
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:19,代码来源:Liquibase.java


示例14: changeLogSync

import liquibase.executor.ExecutorService; //导入依赖的package包/类
public void changeLogSync(String contexts, Writer output) throws LiquibaseException {
    contexts = StringUtils.trimToNull(contexts);
    changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));

    LoggingExecutor outputTemplate = new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database);
    Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);
    ExecutorService.getInstance().setExecutor(database, outputTemplate);

    outputHeader("SQL to add all changesets to database history table");

    changeLogSync(contexts);

    try {
        output.flush();
    } catch (IOException e) {
        throw new LiquibaseException(e);
    }

    ExecutorService.getInstance().setExecutor(database, oldTemplate);
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:21,代码来源:Liquibase.java


示例15: markNextChangeSetRan

import liquibase.executor.ExecutorService; //导入依赖的package包/类
public void markNextChangeSetRan(String contexts, Writer output) throws LiquibaseException {
    contexts = StringUtils.trimToNull(contexts);
    changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, ","));


    LoggingExecutor outputTemplate = new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database);
    Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);
    ExecutorService.getInstance().setExecutor(database, outputTemplate);

    outputHeader("SQL to add all changesets to database history table");

    markNextChangeSetRan(contexts);

    try {
        output.flush();
    } catch (IOException e) {
        throw new LiquibaseException(e);
    }

    ExecutorService.getInstance().setExecutor(database, oldTemplate);
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:22,代码来源:Liquibase.java


示例16: clearCheckSums

import liquibase.executor.ExecutorService; //导入依赖的package包/类
/**
 * Sets checksums to null so they will be repopulated next run
 */
public void clearCheckSums() throws LiquibaseException {
    log.info("Clearing database change log checksums");
    LockService lockService = LockService.getInstance(database);
    lockService.waitForLock();

    try {
        checkDatabaseChangeLogTable(false, null, null);

        UpdateStatement updateStatement = new UpdateStatement(getDatabase().getLiquibaseSchemaName(), getDatabase().getDatabaseChangeLogTableName());
        updateStatement.addNewColumnValue("MD5SUM", null);
        ExecutorService.getInstance().getExecutor(database).execute(updateStatement);
        getDatabase().commit();
    } finally {
        lockService.releaseLock();
    }
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:20,代码来源:Liquibase.java


示例17: replaceChecksum

import liquibase.executor.ExecutorService; //导入依赖的package包/类
@Override
protected void replaceChecksum(ChangeSet changeSet) throws DatabaseException {
    ExecutorService.getInstance().getExecutor(getDatabase()).execute(new UpdateChangeSetChecksumStatement(changeSet));

    getDatabase().commit();
    reset();
}
 
开发者ID:eselyavka,项目名称:liquibase-impala,代码行数:8,代码来源:HiveStandardChangeLogHistoryService.java


示例18: setExecType

import liquibase.executor.ExecutorService; //导入依赖的package包/类
@Override
public void setExecType(ChangeSet changeSet, ChangeSet.ExecType execType) throws DatabaseException {
    Database database = getDatabase();

    ExecutorService.getInstance().getExecutor(database).execute(new MarkChangeSetRanStatement(changeSet, execType));
    getDatabase().commit();
    if (this.ranChangeSetList != null) {
        this.ranChangeSetList.add(new RanChangeSet(changeSet, execType, null, null));
    }

}
 
开发者ID:eselyavka,项目名称:liquibase-impala,代码行数:12,代码来源:HiveStandardChangeLogHistoryService.java


示例19: removeFromHistory

import liquibase.executor.ExecutorService; //导入依赖的package包/类
@Override
public void removeFromHistory(final ChangeSet changeSet) throws DatabaseException {
    Database database = getDatabase();
    ExecutorService.getInstance().getExecutor(database).execute(new RemoveChangeSetRanStatusStatement(changeSet));
    getDatabase().commit();

    if (this.ranChangeSetList != null) {
        this.ranChangeSetList.remove(new RanChangeSet(changeSet));
    }
}
 
开发者ID:eselyavka,项目名称:liquibase-impala,代码行数:11,代码来源:HiveStandardChangeLogHistoryService.java


示例20: getNextSequenceValue

import liquibase.executor.ExecutorService; //导入依赖的package包/类
@Override
public int getNextSequenceValue() throws LiquibaseException {
    if (lastChangeSetSequenceValue == null) {
        if (getDatabase().getConnection() == null) {
            lastChangeSetSequenceValue = 0;
        } else {
            lastChangeSetSequenceValue = ExecutorService.getInstance().getExecutor(getDatabase()).queryForInt(new GetNextChangeSetSequenceValueStatement());
        }
    }

    return ++lastChangeSetSequenceValue;
}
 
开发者ID:eselyavka,项目名称:liquibase-impala,代码行数:13,代码来源:HiveStandardChangeLogHistoryService.java



注:本文中的liquibase.executor.ExecutorService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MessageContext类代码示例发布时间:2022-05-22
下一篇:
Java ThreadPoolProfile类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap