Package org.activiti.engine.impl.interceptor

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


    LogUtil.readJavaUtilLoggingConfigFromClasspath();
  }

  public static void main(String[] args) {
    ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
    CommandExecutor commandExecutor = processEngine.getProcessEngineConfiguration().getCommandExecutorTxRequired();
    commandExecutor.execute(new Command<Object> (){
      public Object execute(CommandContext commandContext) {
        commandContext
          .getSession(DbSqlSession.class)
          .dbSchemaUpdate();
        return null;
View Full Code Here


    public synchronized void run() {
//        if (log.isLoggable(Level.INFO)) {
//          log.info(jobExecutor.getName() + " starting to acquire jobs");
//        }

        final CommandExecutor commandExecutor = jobExecutor.getCommandExecutor();

        // while is not needed - repetition is done by event scheduling
//        while (!isInterrupted) {
              isWaiting.set(false);
          int maxJobsPerAcquisition = jobExecutor.getMaxJobsPerAcquisition();

          try {
            AcquiredJobs acquiredJobs = commandExecutor.execute(jobExecutor.getAcquireJobsCmd());

            for (List<String> jobIds : acquiredJobs.getJobIdBatches()) {
              jobExecutor.executeJobs(jobIds);
            }

            // if all jobs were executed
            millisToWait = jobExecutor.getWaitTimeInMillis();
            int jobsAcquired = acquiredJobs.getJobIdBatches().size();
            if (jobsAcquired < maxJobsPerAcquisition) {
             
              isJobAdded = false;
             
              // check if the next timer should fire before the normal sleep time is over
              Date duedate = new Date(SimulationRunContext.getClock().getCurrentTime().getTime() + millisToWait);
              List<TimerEntity> nextTimers = commandExecutor.execute(new GetUnlockedTimersByDuedateCmd(duedate, new Page(0, 1)));
             
              if (!nextTimers.isEmpty()) {
              long millisTillNextTimer = nextTimers.get(0).getDuedate().getTime() - SimulationRunContext.getClock().getCurrentTime().getTime();
                if (millisTillNextTimer < millisToWait && millisTillNextTimer != 0) {
                  millisToWait = millisTillNextTimer;
View Full Code Here

      this.job = job;
    }
   
    @Override
    public void run() {
      CommandExecutor commandExecutor = ((ProcessEngineConfigurationImpl) ProcessEngines.getDefaultProcessEngine()
          .getProcessEngineConfiguration()).getCommandExecutor();
      commandExecutor.execute(new ExecuteAsyncJobCmd(job));
    }
View Full Code Here

      log.error(EMPTY_LINE);
      log.error(outputMessage.toString());
     
      log.info("dropping and recreating db");
     
      CommandExecutor commandExecutor = ((ProcessEngineImpl)processEngine).getProcessEngineConfiguration().getCommandExecutor();
      commandExecutor.execute(new Command<Object>() {
        public Object execute(CommandContext commandContext) {
          DbSqlSession session = commandContext.getSession(DbSqlSession.class);
          session.dbSchemaDrop();
          session.dbSchemaCreate();
          return null;
View Full Code Here

    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 {
      managementService.deleteJob(timerJob.getId());
      fail();
View Full Code Here

      fail();
    } catch (ActivitiException e) {}
  }
 
  private void createJobWithoutExceptionMsg() {
    CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
    commandExecutor.execute(new Command<Void>() {
      public Void execute(CommandContext commandContext) {
        JobEntityManager jobManager = commandContext.getJobEntityManager();
       
        timerEntity = new TimerEntity();
        timerEntity.setLockOwner(UUID.randomUUID().toString());
View Full Code Here

    });
   
  }
 
  private void createJobWithoutExceptionStacktrace() {
    CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
    commandExecutor.execute(new Command<Void>() {
      public Void execute(CommandContext commandContext) {
        JobEntityManager jobManager = commandContext.getJobEntityManager();
       
        timerEntity = new TimerEntity();
        timerEntity.setLockOwner(UUID.randomUUID().toString());
View Full Code Here

    });
   
 
 
  private void deleteJobInDatabase() {
      CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
      commandExecutor.execute(new Command<Void>() {
        public Void execute(CommandContext commandContext) {
         
          timerEntity.delete();         
          return null;
        }
View Full Code Here

      log.error(EMPTY_LINE);
      log.error(outputMessage.toString());
     
      log.info("dropping and recreating db");
     
      CommandExecutor commandExecutor = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration().getCommandExecutor();
      CommandConfig config = new CommandConfig().transactionNotSupported();
      commandExecutor.execute(config, new Command<Object>() {
        public Object execute(CommandContext commandContext) {
          DbSqlSession session = commandContext.getSession(DbSqlSession.class);
          session.dbSchemaDrop();
          session.dbSchemaCreate();
          return null;
View Full Code Here

      log.error(EMPTY_LINE);
      log.error(outputMessage.toString());
     
      log.info("dropping and recreating db");
     
      CommandExecutor commandExecutor = ((ProcessEngineImpl)processEngine).getProcessEngineConfiguration().getCommandExecutor();
      commandExecutor.execute(new Command<Object>() {
        public Object execute(CommandContext commandContext) {
          DbSqlSession session = commandContext.getSession(DbSqlSession.class);
          session.dbSchemaDrop();
          session.dbSchemaCreate();
          return null;
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.