Package org.activiti.engine.impl

Examples of org.activiti.engine.impl.RuntimeServiceImpl


    assertTextPresent("was updated by another transaction concurrently", threadTwo.exception.getMessage());
  }
 
  @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);
    }
   
  }
View Full Code Here


    assertTextPresent("was updated by another transaction concurrently", threadTwo.exception.getMessage());
  }
 
  @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);
    }
   
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.impl.RuntimeServiceImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.