本文整理汇总了Java中org.activiti.engine.impl.interceptor.CommandInterceptor.setNext方法的典型用法代码示例。如果您正苦于以下问题:Java CommandInterceptor.setNext方法的具体用法?Java CommandInterceptor.setNext怎么用?Java CommandInterceptor.setNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.interceptor.CommandInterceptor
的用法示例。
在下文中一共展示了CommandInterceptor.setNext方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCompetingSignalsWithRetry
import org.activiti.engine.impl.interceptor.CommandInterceptor; //导入方法依赖的package包/类
@Deployment(resources={"org/activiti/engine/test/concurrency/CompetingSignalsTest.testCompetingSignals.bpmn20.xml"})
public void testCompetingSignalsWithRetry() throws Exception {
RuntimeServiceImpl runtimeServiceImpl = (RuntimeServiceImpl)runtimeService;
CommandExecutor before = runtimeServiceImpl.getCommandExecutor();
try {
CommandInterceptor retryInterceptor = new RetryInterceptor();
retryInterceptor.setNext(before);
runtimeServiceImpl.setCommandExecutor(retryInterceptor);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("CompetingSignalsProcess");
String processInstanceId = processInstance.getId();
log.fine("test thread starts thread one");
SignalThread threadOne = new SignalThread(processInstanceId);
threadOne.startAndWaitUntilControlIsReturned();
log.fine("test thread continues to start thread two");
SignalThread threadTwo = new SignalThread(processInstanceId);
threadTwo.startAndWaitUntilControlIsReturned();
log.fine("test thread notifies thread 1");
threadOne.proceedAndWaitTillDone();
assertNull(threadOne.exception);
log.fine("test thread notifies thread 2");
threadTwo.proceedAndWaitTillDone();
assertNull(threadTwo.exception);
} finally {
// reset the command executor
runtimeServiceImpl.setCommandExecutor(before);
}
}
示例2: testCompetingSignalsWithRetry
import org.activiti.engine.impl.interceptor.CommandInterceptor; //导入方法依赖的package包/类
@Deployment(resources={"org/activiti/engine/test/concurrency/CompetingSignalsTest.testCompetingSignals.bpmn20.xml"})
public void testCompetingSignalsWithRetry() throws Exception {
RuntimeServiceImpl runtimeServiceImpl = (RuntimeServiceImpl)runtimeService;
CommandExecutorImpl before = (CommandExecutorImpl) runtimeServiceImpl.getCommandExecutor();
try {
CommandInterceptor retryInterceptor = new RetryInterceptor();
retryInterceptor.setNext(before.getFirst());
runtimeServiceImpl.setCommandExecutor(new CommandExecutorImpl(before.getDefaultConfig(), retryInterceptor));
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("CompetingSignalsProcess");
String processInstanceId = processInstance.getId();
log.debug("test thread starts thread one");
SignalThread threadOne = new SignalThread(processInstanceId);
threadOne.startAndWaitUntilControlIsReturned();
log.debug("test thread continues to start thread two");
SignalThread threadTwo = new SignalThread(processInstanceId);
threadTwo.startAndWaitUntilControlIsReturned();
log.debug("test thread notifies thread 1");
threadOne.proceedAndWaitTillDone();
assertNull(threadOne.exception);
log.debug("test thread notifies thread 2");
threadTwo.proceedAndWaitTillDone();
assertNull(threadTwo.exception);
} finally {
// restore the command executor
runtimeServiceImpl.setCommandExecutor(before);
}
}