Package org.activiti.engine.impl.interceptor

Examples of org.activiti.engine.impl.interceptor.CommandExecutor


      .addClasspathResource(TEST_PROCESS_CALL_ACTIVITY)
      .deploy();
    assertEquals(2, repositoryService.createProcessDefinitionQuery().processDefinitionKey("parentProcess").count());

    // migrate process instance to new process definition version
    CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
    commandExecutor.execute(new SetProcessDefinitionVersionCmd(pi.getId(), 2));

    // signal process instance
    runtimeService.signal(execution.getId());

    // should be finished now
View Full Code Here


            .addClasspathResource(TEST_PROCESS_NESTED_SUB_EXECUTIONS)
            .deploy();
    assertEquals(2, repositoryService.createProcessDefinitionQuery().count());

    // migrate process instance to new process definition version
    CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
    commandExecutor.execute(new SetProcessDefinitionVersionCmd(pi.getId(), 2));

    // check that all executions of the instance now use the new process definition version
    ProcessDefinition newProcessDefinition = repositoryService
            .createProcessDefinitionQuery()
            .processDefinitionVersion(2)
View Full Code Here

  }

  public synchronized void run() {
    log.info("{} starting to acquire async jobs due");

    final CommandExecutor commandExecutor = asyncExecutor.getCommandExecutor();

    while (!isInterrupted) {
     
      try {
        AcquiredJobEntities acquiredJobs = commandExecutor.execute(new AcquireTimerJobsCmd(
            asyncExecutor.getLockOwner(), asyncExecutor.getTimerLockTimeInMillis(),
            asyncExecutor.getMaxTimerJobsPerAcquisition()));
       
        for (JobEntity job : acquiredJobs.getJobs()) {
          asyncExecutor.executeAsyncJob(job);
View Full Code Here

  }

  public synchronized void run() {
    log.info("{} starting to acquire async jobs due");

    final CommandExecutor commandExecutor = asyncExecutor.getCommandExecutor();

    while (!isInterrupted) {
     
      try {
        AcquiredJobEntities acquiredJobs = commandExecutor.execute(new AcquireAsyncJobsDueCmd(asyncExecutor));
       
        // if all jobs were executed
        millisToWait = asyncExecutor.getDefaultAsyncJobAcquireWaitTimeInMillis();
        int jobsAcquired = acquiredJobs.size();
        if (jobsAcquired >= asyncExecutor.getMaxAsyncJobsDuePerAcquisition()) {
View Full Code Here

  }

  public synchronized void run() {
    log.info("{} starting to acquire jobs", jobExecutor.getName());

    final CommandExecutor commandExecutor = jobExecutor.getCommandExecutor();

    while (!isInterrupted) {
      isJobAdded = false;
     
      Integer nrOfAquiredJobs = 0;
      try {
       
        // Acquire jobs in transaction
        nrOfAquiredJobs = commandExecutor.execute(new Command<Integer>() {
         
          public Integer execute(CommandContext commandContext) {
            return commandContext.getJobEntityManager().updateJobLockForAllJobs(
                jobExecutor.getLockOwner(),
                getLockExpirationTime(commandContext, jobExecutor.getLockTimeInMillis()));
View Full Code Here

  }

  public synchronized void run() {
    log.info("{} starting to acquire jobs", jobExecutor.getName());

    final CommandExecutor commandExecutor = jobExecutor.getCommandExecutor();

    while (!isInterrupted) {
      isJobAdded = false;
      int maxJobsPerAcquisition = jobExecutor.getMaxJobsPerAcquisition();

      try {
        AcquiredJobs acquiredJobs = commandExecutor.execute(jobExecutor.getAcquireJobsCmd());
       
        for (List<String> jobIds : acquiredJobs.getJobIdBatches()) {
          jobExecutor.executeJobs(jobIds);
        }
View Full Code Here

  }

  protected void handleSingleJob() {
    final SingleJobExecutorContext jobExecutorContext = new SingleJobExecutorContext();
    final List<JobEntity> currentProcessorJobQueue = jobExecutorContext.getCurrentProcessorJobQueue();
    final CommandExecutor commandExecutor = jobExecutor.getCommandExecutor();

    currentProcessorJobQueue.add(job);

    Context.setJobExecutorContext(jobExecutorContext);
    try {
      while (!currentProcessorJobQueue.isEmpty()) {

        JobEntity currentJob = currentProcessorJobQueue.remove(0);
        try {
          commandExecutor.execute(new ExecuteJobsCmd(currentJob));
        } catch (Throwable e) {
          log.error("exception during job execution: {}", e.getMessage(), e);
        } finally {
          jobExecutor.jobDone(currentJob);
        }
View Full Code Here

  }

  protected void handleMultipleJobs() {
    final MultipleJobsExecutorContext jobExecutorContext = new MultipleJobsExecutorContext();
    final List<String> currentProcessorJobQueue = jobExecutorContext.getCurrentProcessorJobQueue();
    final CommandExecutor commandExecutor = jobExecutor.getCommandExecutor();

    currentProcessorJobQueue.addAll(jobIds);

    Context.setJobExecutorContext(jobExecutorContext);
    try {
      while (!currentProcessorJobQueue.isEmpty()) {

        String currentJobId = currentProcessorJobQueue.remove(0);
        try {
          commandExecutor.execute(new ExecuteJobsCmd(currentJobId));
        } catch (Throwable e) {
          log.error("exception during job execution: {}", e.getMessage(), e);
        } finally {
          jobExecutor.jobDone(currentJobId);
        }
View Full Code Here

            ActivitiEventType.JOB_EXECUTION_SUCCESS, job));
      }
     
    } catch (Throwable exception) {
      // When transaction is rolled back, decrement retries
      CommandExecutor commandExecutor = Context
        .getProcessEngineConfiguration()
        .getCommandExecutor();
     
      commandContext.getTransactionContext().addTransactionListener(
        TransactionState.ROLLED_BACK,
View Full Code Here

    repositoryService.deleteDeployment(secondDeploymentId, true);
  }
 
  private void cleanDB() {
    String jobId = managementService.createJobQuery().singleResult().getId();
    CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
    commandExecutor.execute(new CancelJobsCmd(jobId));
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.impl.interceptor.CommandExecutor

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.