@Override public boolean pauseExecution(Long executionId) { ExecutionState executionState = executionStateService.readByExecutionIdAndBranchId(executionId, ExecutionState.EMPTY_BRANCH); if (canBePaused(executionState)) { pauseResumeService.pauseExecution(executionId, null, PauseReason.USER_PAUSED); return true; } else { return false; } }
@Override public boolean pauseExecution(Long executionId) { ExecutionState executionState = executionStateService.readByExecutionIdAndBranchId(executionId, ExecutionState.EMPTY_BRANCH); if (canBePaused(executionState)) { pauseResumeService.pauseExecution(executionId, null, PauseReason.USER_PAUSED); return true; } else { return false; } }
private void pauseFlow(PauseReason reason, Execution execution) throws InterruptedException { SystemContext systemContext = execution.getSystemContext(); Long executionId = execution.getExecutionId(); String branchId = systemContext.getBranchId(); // If USER_PAUSED send such event if (!isDebuggerMode(execution.getSystemContext()) && reason.equals(PauseReason.USER_PAUSED)) { if (branchId != null) { // we pause the branch because the Parent was user-paused (see findPauseReason) pauseService.pauseExecution(executionId, branchId, reason); // this creates a DB record for this branch, as Pending-paused } } addPauseEvent(systemContext); // dump bus events here because out side is too late dumpBusEvents(execution); // Write execution to the db! Pay attention - do not do anything to the execution or its context after this line!!! pauseService.writeExecutionObject(executionId, branchId, execution); if (logger.isDebugEnabled()) { logger.debug("Execution with execution_id: " + execution.getExecutionId() + " is paused!"); } }
private Long pauseExecution(Execution execution) { String branchId = execution.getSystemContext().getBranchId(); ExecutionSummary pe = pauseResumeService.readPausedExecution(execution.getExecutionId(), branchId); //Check if this execution is not paused already (by user) Long pauseId; if (pe == null) { // When cancel execution and no worker in group it should return to be paused without any termination type execution.getSystemContext().setFlowTerminationType(null); pauseId = pauseResumeService.pauseExecution(execution.getExecutionId(), branchId, PauseReason.NO_WORKERS_IN_GROUP); pauseResumeService.writeExecutionObject(execution.getExecutionId(), branchId, execution); } else { pauseId = null; //If yes - just write the object pauseResumeService.writeExecutionObject(execution.getExecutionId(), branchId, execution); } return pauseId; }