public void execute(CommandContext commandContext) { // passed commandContext may be in an inconsistent state commandExecutor.execute(new Command<Void>() { @Override public Void execute(CommandContext commandContext) { Map<String, Long> report = reportMetrics(); boolean isRescheduleNow = shouldRescheduleNow(); new HistoryCleanupSchedulerCmd(isRescheduleNow, report, configuration, jobId).execute(commandContext); return null; } }); }
public long sum() { callback = new Command() { @Override public Object execute(CommandContext commandContext) { return commandContext.getMeterLogManager() .executeSelectSum(MetricsQueryImpl.this); } }; return (Long) commandExecutor.execute(this); }
public List<HistoricProcessInstance> getRunningHistoricProcessInstances(Date startedAfter, Date startedAt, int maxResults) { return commandExecutor.execute( new OptimizeRunningHistoricProcessInstanceQueryCmd(startedAfter, startedAt, maxResults) ); }
protected void executeHelperCaseCommand(HelperCaseCommand command) { processEngineConfiguration .getCommandExecutorTxRequired() .execute(command); }
public static void createSchema(ProcessEngineConfigurationImpl processEngineConfiguration) { processEngineConfiguration.getCommandExecutorTxRequired() .execute(new Command<Object>() { public Object execute(CommandContext commandContext) { commandContext.getSession(PersistenceSession.class).dbSchemaCreate(); return null; } }); }
@Override public String getHistoricExternalTaskLogErrorDetails(String historicExternalTaskLogId) { return commandExecutor.execute(new GetHistoricExternalTaskLogErrorDetailsCmd(historicExternalTaskLogId)); } }
/** * Purges the database and the deployment cache. */ public PurgeReport purge() { return commandExecutor.execute(new PurgeDatabaseAndCacheCmd()); }
public List<HistoricProcessInstance> getCompletedHistoricProcessInstances(Date finishedAfter, Date finishedAt, int maxResults) { return commandExecutor.execute( new OptimizeCompletedHistoricProcessInstanceQueryCmd(finishedAfter, finishedAt, maxResults) ); }
private void deleteHistoryCleanupJobs() { final List<Job> jobs = historyService.findHistoryCleanupJobs(); for (final Job job: jobs) { processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command<Void>() { public Void execute(CommandContext commandContext) { commandContext.getJobManager().deleteJob((JobEntity) job); return null; } }); } }
@Override public void suspend() { validateParameters(); SuspendJobCmd command = new SuspendJobCmd(this); commandExecutor.execute(command); }
@Override public void activate() { validateParameters(); ActivateJobCmd command = new ActivateJobCmd(this); commandExecutor.execute(command); }
@SuppressWarnings("unchecked") public List<U> list() { this.resultType = ResultType.LIST; if (commandExecutor!=null) { return (List<U>) commandExecutor.execute(this); } return evaluateExpressionsAndExecuteList(Context.getCommandContext(), null); }
@Override public void send() { if (executionId != null && isTenantIdSet) { throw LOG.exceptionDeliverSignalToSingleExecutionWithTenantId(); } SignalEventReceivedCmd command = new SignalEventReceivedCmd(this); commandExecutor.execute(command); }
@Override public void messageEventReceived(String messageName, String executionId, Map<String, Object> processVariables) { ensureNotNull("messageName", messageName); commandExecutor.execute(new MessageEventReceivedCmd(messageName, executionId, processVariables)); }
@Override public void suspend() { validateParameters(); SuspendJobDefinitionCmd command = new SuspendJobDefinitionCmd(this); commandExecutor.execute(command); }
protected void clearMeterLog() { engineConfiguration.getCommandExecutorTxRequired() .execute(new Command<Object>() { public Object execute(CommandContext commandContext) { commandContext.getMeterLogManager().deleteAll(); return null; } }); }
protected void createJob(final String handlerType) { processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command<String>() { public String execute(CommandContext commandContext) { MessageEntity message = createMessage(handlerType); commandContext.getJobManager().send(message); return message.getId(); } }); }
protected void makeSureJobDue(final Job job) { processEngineConfiguration.getCommandExecutorTxRequired() .execute(new Command<Void>() { public Void execute(CommandContext commandContext) { Date currentTime = ClockUtil.getCurrentTime(); commandContext.getJobManager() .findJobById(job.getId()) .setDuedate(new Date(currentTime.getTime() - 10000)); return null; } }); }
protected synchronized void getNewBlock() { // TODO http://jira.codehaus.org/browse/ACT-45 use a separate 'requiresNew' command executor IdBlock idBlock = commandExecutor.execute(new GetNextIdBlockCmd(idBlockSize)); this.nextId = idBlock.getNextId(); this.lastId = idBlock.getLastId(); }
public void saveUser(User user) { try { commandExecutor.execute(new SaveUserCmd(user)); } catch (ProcessEngineException ex) { if (ExceptionUtil.checkConstraintViolationException(ex)) { throw new BadUserRequestException("The user already exists", ex); } throw ex; } }