当前位置: 首页>>代码示例>>Java>>正文


Java CommandInterceptor.setNext方法代码示例

本文整理汇总了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);
  }
  
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:34,代码来源:CompetingSignalsTest.java

示例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);
  }
  
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:35,代码来源:CompetingSignalsTest.java


注:本文中的org.activiti.engine.impl.interceptor.CommandInterceptor.setNext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。