Search in sources :

Example 1 with DbIdGenerator

use of org.camunda.bpm.engine.impl.db.DbIdGenerator in project camunda-bpm-platform by camunda.

the class ProcessEngineConfigurationImpl method initIdGenerator.

// id generator /////////////////////////////////////////////////////////////
protected void initIdGenerator() {
    if (idGenerator == null) {
        CommandExecutor idGeneratorCommandExecutor = null;
        if (idGeneratorDataSource != null) {
            ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneProcessEngineConfiguration();
            processEngineConfiguration.setDataSource(idGeneratorDataSource);
            processEngineConfiguration.setDatabaseSchemaUpdate(DB_SCHEMA_UPDATE_FALSE);
            processEngineConfiguration.init();
            idGeneratorCommandExecutor = processEngineConfiguration.getCommandExecutorTxRequiresNew();
        } else if (idGeneratorDataSourceJndiName != null) {
            ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneProcessEngineConfiguration();
            processEngineConfiguration.setDataSourceJndiName(idGeneratorDataSourceJndiName);
            processEngineConfiguration.setDatabaseSchemaUpdate(DB_SCHEMA_UPDATE_FALSE);
            processEngineConfiguration.init();
            idGeneratorCommandExecutor = processEngineConfiguration.getCommandExecutorTxRequiresNew();
        } else {
            idGeneratorCommandExecutor = commandExecutorTxRequiresNew;
        }
        DbIdGenerator dbIdGenerator = new DbIdGenerator();
        dbIdGenerator.setIdBlockSize(idBlockSize);
        dbIdGenerator.setCommandExecutor(idGeneratorCommandExecutor);
        idGenerator = dbIdGenerator;
    }
}
Also used : CommandExecutor(org.camunda.bpm.engine.impl.interceptor.CommandExecutor) DbIdGenerator(org.camunda.bpm.engine.impl.db.DbIdGenerator)

Aggregations

DbIdGenerator (org.camunda.bpm.engine.impl.db.DbIdGenerator)1 CommandExecutor (org.camunda.bpm.engine.impl.interceptor.CommandExecutor)1