protected <T> void executeInContext(final Runnable runnable, ProcessDefinitionEntity contextDefinition) { ProcessApplicationContextUtil.doContextSwitch(runnable, contextDefinition); }
public static void doContextSwitch(final Runnable runnable, ProcessDefinitionEntity contextDefinition) { ProcessApplicationReference processApplication = getTargetProcessApplication(contextDefinition); if (requiresContextSwitch(processApplication)) { Context.executeWithinProcessApplication(new Callable<Void>() { @Override public Void call() throws Exception { runnable.run(); return null; } }, processApplication); } else { runnable.run(); } } }
public static ProcessApplicationReference getTargetProcessApplication(ExecutionEntity execution) { if (execution == null) { return null; } ProcessApplicationReference processApplicationForDeployment = getTargetProcessApplication((ProcessDefinitionEntity) execution.getProcessDefinition()); // logg application context switch details if(LOG.isContextSwitchLoggable() && processApplicationForDeployment == null) { loggContextSwitchDetails(execution); } return processApplicationForDeployment; }
public static ProcessApplicationReference getTargetProcessApplication(CoreExecution execution) { if (execution instanceof ExecutionEntity) { return getTargetProcessApplication((ExecutionEntity) execution); } else { return getTargetProcessApplication((CaseExecutionEntity) execution); } }
public static ProcessApplicationReference getTargetProcessApplication(ResourceDefinitionEntity definition) { ProcessApplicationReference reference = getTargetProcessApplication(definition.getDeploymentId()); if (reference == null && areProcessApplicationsRegistered()) { ResourceDefinitionEntity previous = definition.getPreviousDefinition(); // do it in a iterative way instead of recursive to avoid // a possible StackOverflowException in cases with a lot // of versions of a definition while (previous != null) { reference = getTargetProcessApplication(previous.getDeploymentId()); if (reference == null) { previous = previous.getPreviousDefinition(); } else { return reference; } } } return reference; }
protected boolean requiresContextSwitch(ProcessApplicationReference processApplicationReference) { return ProcessApplicationContextUtil.requiresContextSwitch(processApplicationReference); }
public static ProcessApplicationReference getTargetProcessApplication(CoreExecution execution) { if (execution instanceof ExecutionEntity) { return getTargetProcessApplication((ExecutionEntity) execution); } else { return getTargetProcessApplication((CaseExecutionEntity) execution); } }
public static ProcessApplicationReference getTargetProcessApplication(ResourceDefinitionEntity definition) { ProcessApplicationReference reference = getTargetProcessApplication(definition.getDeploymentId()); if (reference == null && areProcessApplicationsRegistered()) { ResourceDefinitionEntity previous = definition.getPreviousDefinition(); // do it in a iterative way instead of recursive to avoid // a possible StackOverflowException in cases with a lot // of versions of a definition while (previous != null) { reference = getTargetProcessApplication(previous.getDeploymentId()); if (reference == null) { previous = previous.getPreviousDefinition(); } else { return reference; } } } return reference; }
protected boolean requiresContextSwitch(ProcessApplicationReference processApplicationReference) { return ProcessApplicationContextUtil.requiresContextSwitch(processApplicationReference); }
public static void doContextSwitch(final Runnable runnable, ProcessDefinitionEntity contextDefinition) { ProcessApplicationReference processApplication = getTargetProcessApplication(contextDefinition); if (requiresContextSwitch(processApplication)) { Context.executeWithinProcessApplication(new Callable<Void>() { @Override public Void call() throws Exception { runnable.run(); return null; } }, processApplication); } else { runnable.run(); } } }
protected boolean isSymptomOfContextSwitchFailure(Throwable t, ExecutionEntity contextExecution) { // a context switch failure can occur, if the current engine has no PA registration for the deployment // subclasses may assert the actual throwable to narrow down the diagnose return ProcessApplicationContextUtil.getTargetProcessApplication(contextExecution) == null; }
public static ProcessApplicationReference getTargetProcessApplication(CaseExecutionEntity execution) { if (execution == null) { return null; } ProcessApplicationReference processApplicationForDeployment = getTargetProcessApplication((CaseDefinitionEntity) execution.getCaseDefinition()); // logg application context switch details if(LOG.isContextSwitchLoggable() && processApplicationForDeployment == null) { loggContextSwitchDetails(execution); } return processApplicationForDeployment; }
public static ProcessApplicationReference getTargetProcessApplication(ResourceDefinitionEntity definition) { ProcessApplicationReference reference = getTargetProcessApplication(definition.getDeploymentId()); if (reference == null && areProcessApplicationsRegistered()) { ResourceDefinitionEntity previous = definition.getPreviousDefinition(); // do it in a iterative way instead of recursive to avoid // a possible StackOverflowException in cases with a lot // of versions of a definition while (previous != null) { reference = getTargetProcessApplication(previous.getDeploymentId()); if (reference == null) { previous = previous.getPreviousDefinition(); } else { return reference; } } } return reference; }
protected boolean requiresContextSwitch(ProcessApplicationReference processApplicationReference) { return ProcessApplicationContextUtil.requiresContextSwitch(processApplicationReference); }
protected <T> void executeInContext(final Runnable runnable, ProcessDefinitionEntity contextDefinition) { ProcessApplicationContextUtil.doContextSwitch(runnable, contextDefinition); }
protected void performNotification(final DelegateExecution execution, Callable<Void> notification) throws Exception { final ProcessApplicationReference processApp = ProcessApplicationContextUtil.getTargetProcessApplication((ExecutionEntity) execution); if (processApp == null) { // ignore silently LOG.noTargetProcessApplicationForExecution(execution); } else { if (ProcessApplicationContextUtil.requiresContextSwitch(processApp)) { // this should not be necessary since context switch is already performed by OperationContext and / or DelegateInterceptor Context.executeWithinProcessApplication(notification, processApp, new InvocationContext(execution)); } else { // context switch already performed notification.call(); } } }
protected boolean isSymptomOfContextSwitchFailure(Throwable t, ExecutionEntity contextExecution) { // a context switch failure can occur, if the current engine has no PA registration for the deployment // subclasses may assert the actual throwable to narrow down the diagnose return ProcessApplicationContextUtil.getTargetProcessApplication(contextExecution) == null; }
public static ProcessApplicationReference getTargetProcessApplication(ExecutionEntity execution) { if (execution == null) { return null; } ProcessApplicationReference processApplicationForDeployment = getTargetProcessApplication((ProcessDefinitionEntity) execution.getProcessDefinition()); // logg application context switch details if(LOG.isContextSwitchLoggable() && processApplicationForDeployment == null) { loggContextSwitchDetails(execution); } return processApplicationForDeployment; }
protected boolean requiresContextSwitch(ProcessApplicationReference processApplicationReference) { return ProcessApplicationContextUtil.requiresContextSwitch(processApplicationReference); }
protected <T> void executeInContext(final Runnable runnable, ProcessDefinitionEntity contextDefinition) { ProcessApplicationContextUtil.doContextSwitch(runnable, contextDefinition); }