public String databaseSchemaUpgrade(final Connection connection, final String catalog, final String schema) { CommandConfig config = commandExecutor.getDefaultConfig().transactionNotSupported(); return commandExecutor.execute(config, new Command<String>() { public String execute(CommandContext commandContext) { DbSqlSessionFactory dbSqlSessionFactory = (DbSqlSessionFactory) commandContext.getSessionFactories().get(DbSqlSession.class); DbSqlSession dbSqlSession = new DbSqlSession(dbSqlSessionFactory, commandContext.getEntityCache(), connection, catalog, schema); commandContext.getSessions().put(DbSqlSession.class, dbSqlSession); return dbSqlSession.dbSchemaUpdate(); } }); }
@Override public void closeFailure(CommandContext commandContext) { if (commandContext.getEventDispatcher().isEnabled()) { commandContext.getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityExceptionEvent( ActivitiEventType.JOB_EXECUTION_FAILURE, job, commandContext.getException())); } CommandConfig commandConfig = commandExecutor.getDefaultConfig().transactionRequiresNew(); FailedJobCommandFactory failedJobCommandFactory = commandContext.getFailedJobCommandFactory(); Command<Object> cmd = failedJobCommandFactory.getCommand(job.getId(), commandContext.getException()); log.trace("Using FailedJobCommandFactory '" + failedJobCommandFactory.getClass() + "' and command of type '" + cmd.getClass() + "'"); commandExecutor.execute(commandConfig, cmd); }
@Override public Void execute(CommandContext commandContext) { CommandConfig commandConfig = processEngineConfiguration.getCommandExecutor().getDefaultConfig().transactionRequiresNew(); FailedJobCommandFactory failedJobCommandFactory = commandContext.getFailedJobCommandFactory(); Command<Object> cmd = failedJobCommandFactory.getCommand(job.getId(), exception); log.trace("Using FailedJobCommandFactory '" + failedJobCommandFactory.getClass() + "' and command of type '" + cmd.getClass() + "'"); processEngineConfiguration.getCommandExecutor().execute(commandConfig, cmd); // Dispatch an event, indicating job execution failed in a // try-catch block, to prevent the original exception to be swallowed if (commandContext.getEventDispatcher().isEnabled()) { try { commandContext.getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityExceptionEvent(ActivitiEventType.JOB_EXECUTION_FAILURE, job, exception)); } catch (Throwable ignore) { log.warn("Exception occurred while dispatching job failure event, ignoring.", ignore); } } return null; }
public String databaseSchemaUpgrade(final Connection connection, final String catalog, final String schema) { CommandConfig config = commandExecutor.getDefaultConfig().transactionNotSupported(); return commandExecutor.execute(config, new Command<String>() { public String execute(CommandContext commandContext) { DbSqlSessionFactory dbSqlSessionFactory = (DbSqlSessionFactory) commandContext.getSessionFactories().get(DbSqlSession.class); DbSqlSession dbSqlSession = new DbSqlSession(dbSqlSessionFactory, commandContext.getEntityCache(), connection, catalog, schema); commandContext.getSessions().put(DbSqlSession.class, dbSqlSession); return dbSqlSession.dbSchemaUpdate(); } }); }
@Override public void execute(CommandContext commandContext) { CommandConfig commandConfig = commandExecutor.getDefaultConfig().transactionRequiresNew(); FailedJobCommandFactory failedJobCommandFactory = commandContext.getFailedJobCommandFactory(); Command<Object> cmd = failedJobCommandFactory.getCommand(jobId, exception); LOGGER.trace("Using FailedJobCommandFactory '{}' and command of type '{}'", failedJobCommandFactory.getClass(), cmd.getClass()); commandExecutor.execute(commandConfig, cmd); }
@Override public void closeFailure(CommandContext commandContext) { if (commandContext.getEventDispatcher().isEnabled()) { commandContext.getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityExceptionEvent( ActivitiEventType.JOB_EXECUTION_FAILURE, job, commandContext.getException())); } CommandConfig commandConfig = commandExecutor.getDefaultConfig().transactionRequiresNew(); FailedJobCommandFactory failedJobCommandFactory = commandContext.getFailedJobCommandFactory(); Command<Object> cmd = failedJobCommandFactory.getCommand(job.getId(), commandContext.getException()); log.trace("Using FailedJobCommandFactory '" + failedJobCommandFactory.getClass() + "' and command of type '" + cmd.getClass() + "'"); commandExecutor.execute(commandConfig, cmd); }
@Override public Void execute(CommandContext commandContext) { CommandConfig commandConfig = commandExecutor.getDefaultConfig().transactionRequiresNew(); FailedJobCommandFactory failedJobCommandFactory = commandContext.getFailedJobCommandFactory(); Command<Object> cmd = failedJobCommandFactory.getCommand(job.getId(), exception); LOGGER.trace("Using FailedJobCommandFactory '{}' and command of type '{}'", failedJobCommandFactory.getClass(), cmd.getClass()); commandExecutor.execute(commandConfig, cmd); // Dispatch an event, indicating job execution failed in a try-catch block, to prevent the original // exception to be swallowed if (commandContext.getEventDispatcher().isEnabled()) { try { commandContext.getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityExceptionEvent( FlowableEngineEventType.JOB_EXECUTION_FAILURE, job, exception)); } catch (Throwable ignore) { LOGGER.warn("Exception occurred while dispatching job failure event, ignoring.", ignore); } } return null; }
@Override public Void execute(CommandContext commandContext) { if (job.getProcessDefinitionId() != null && Activiti5Util.isActiviti5ProcessDefinitionId(commandContext, job.getProcessDefinitionId())) { Activiti5CompatibilityHandler activiti5CompatibilityHandler = Activiti5Util.getActiviti5CompatibilityHandler(); activiti5CompatibilityHandler.handleFailedJob(job, exception); return null; } CommandConfig commandConfig = processEngineConfiguration.getCommandExecutor().getDefaultConfig().transactionRequiresNew(); FailedJobCommandFactory failedJobCommandFactory = commandContext.getFailedJobCommandFactory(); Command<Object> cmd = failedJobCommandFactory.getCommand(job.getId(), exception); log.trace("Using FailedJobCommandFactory '" + failedJobCommandFactory.getClass() + "' and command of type '" + cmd.getClass() + "'"); processEngineConfiguration.getCommandExecutor().execute(commandConfig, cmd); // Dispatch an event, indicating job execution failed in a // try-catch block, to prevent the original exception to be swallowed if (commandContext.getEventDispatcher().isEnabled()) { try { commandContext.getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityExceptionEvent(ActivitiEventType.JOB_EXECUTION_FAILURE, job, exception)); } catch (Throwable ignore) { log.warn("Exception occurred while dispatching job failure event, ignoring.", ignore); } } return null; }