Examples of AcquireTimerJobsCmd


Examples of org.activiti.engine.impl.cmd.AcquireTimerJobsCmd

    // We need to move time at least one hour to make the timer executable
    processEngineConfiguration.getClock().setCurrentTime(new Date(processEngineConfiguration.getClock().getCurrentTime().getTime() + 7200000L));

    // Acquire job by running the acquire command manually
    ProcessEngineImpl processEngineImpl = (ProcessEngineImpl) processEngine;
    AcquireTimerJobsCmd acquireJobsCmd = new AcquireTimerJobsCmd("testLockOwner", 60000, 5);
    CommandExecutor commandExecutor = processEngineImpl.getProcessEngineConfiguration().getCommandExecutor();
    commandExecutor.execute(acquireJobsCmd);
   
    // Try to delete the job. This should fail.
    try {
View Full Code Here

Examples of org.activiti.engine.impl.cmd.AcquireTimerJobsCmd

        commandContext.getJobEntityManager().schedule(timer);
        return timer.getId();
      }
    });

    AcquiredJobEntities acquiredJobs = commandExecutor.execute(new AcquireTimerJobsCmd("testLockOwner", 10000, 5));
    assertEquals(0, acquiredJobs.size());

    processEngineConfiguration.getClock().setCurrentTime(new Date(SOME_TIME + (20 * SECOND)));

    acquiredJobs = commandExecutor.execute(new AcquireTimerJobsCmd("testLockOwner", 10000, 5));
    assertEquals(1, acquiredJobs.size());

    JobEntity job = acquiredJobs.getJobs().iterator().next();

    assertEquals(jobId, job.getId());
View Full Code Here

Examples of org.activiti.engine.impl.cmd.AcquireTimerJobsCmd

      });
  }

  private AcquiredJobEntities executeAcquireJobsCommand() {
    return processEngineConfiguration.getCommandExecutor()
      .execute(new AcquireTimerJobsCmd("testLockOwner", 60000, 5));
  }
View Full Code Here

Examples of org.activiti.engine.impl.cmd.AcquireTimerJobsCmd

    }
    public void run() {
      try {
        processEngineConfiguration
          .getCommandExecutor()
          .execute(new ControlledCommand(activeThread, new AcquireTimerJobsCmd("testLockOwner", 60000, 5)));

      } catch (ActivitiOptimisticLockingException e) {
        this.exception = e;
      }
      log.debug("{} ends", getName());
View Full Code Here

Examples of org.activiti.engine.impl.cmd.AcquireTimerJobsCmd

    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
TOP
Copyright © 2018 www.massapi.com. 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.