Examples of JobExecutor


Examples of org.camunda.bpm.engine.impl.jobexecutor.JobExecutor

    Object value = defaultJobAcquisitionService.getValue();
    assertNotNull(value);
    assertTrue(value instanceof JobExecutor);

    JobExecutor defaultJobExecutor = (JobExecutor) value;
    assertEquals(300000, defaultJobExecutor.getLockTimeInMillis());
    assertEquals(5000, defaultJobExecutor.getWaitTimeInMillis());
    assertEquals(3, defaultJobExecutor.getMaxJobsPerAcquisition());

    // "anders" job acquisition /////////////////////////////////////////////////////////
    ServiceController<?> andersJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("anders"));
    assertNotNull("platform job acquisition service 'anders' should be installed", andersJobAcquisitionService);

    value = andersJobAcquisitionService.getValue();
    assertNotNull(value);
    assertTrue(value instanceof JobExecutor);

    JobExecutor andersJobExecutor = (JobExecutor) value;
    assertEquals(600000, andersJobExecutor.getLockTimeInMillis());
    assertEquals(10000, andersJobExecutor.getWaitTimeInMillis());
    assertEquals(5, andersJobExecutor.getMaxJobsPerAcquisition());

    // "mixed" job acquisition /////////////////////////////////////////////////////////
    ServiceController<?> mixedJobAcquisitionService = container.getService(ServiceNames.forMscRuntimeContainerJobExecutorService("mixed"));
    assertNotNull("platform job acquisition service 'mixed' should be installed", mixedJobAcquisitionService);

    value = mixedJobAcquisitionService.getValue();
    assertNotNull(value);
    assertTrue(value instanceof JobExecutor);

    JobExecutor mixedJobExecutor = (JobExecutor) value;
    assertEquals(500000, mixedJobExecutor.getLockTimeInMillis());
    // default values
    assertEquals(5000, mixedJobExecutor.getWaitTimeInMillis());
    assertEquals(3, mixedJobExecutor.getMaxJobsPerAcquisition());

  }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.jobexecutor.JobExecutor

    if (exception == null || shouldDecrementRetriesFor(exception)) {
      job.setRetries(job.getRetries() - 1);
    }

    JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor();
    MessageAddedNotification messageAddedNotification = new MessageAddedNotification(jobExecutor);
    TransactionContext transactionContext = commandContext.getTransactionContext();
    transactionContext.addTransactionListener(TransactionState.COMMITTED, messageAddedNotification);

    return null;
View Full Code Here

Examples of org.camunda.bpm.engine.impl.jobexecutor.JobExecutor

  }
 
  //////////////////////// copied from AbstractActivitiTestcase
 
  public void waitForJobExecutorToProcessAllJobs(long maxMillisToWait, long intervalMillis) {
    JobExecutor jobExecutor = processEngineConfiguration.getJobExecutor();
    jobExecutor.start();

    try {
      Timer timer = new Timer();
      InteruptTask task = new InteruptTask(Thread.currentThread());
      timer.schedule(task, maxMillisToWait);
      boolean areJobsAvailable = true;
      try {
        while (areJobsAvailable && !task.isTimeLimitExceeded()) {
          Thread.sleep(intervalMillis);
          areJobsAvailable = areJobsAvailable();
        }
      } catch (InterruptedException e) {
      } finally {
        timer.cancel();
      }
      if (areJobsAvailable) {
        throw new ProcessEngineException("time limit of " + maxMillisToWait + " was exceeded");
      }

    } finally {
      jobExecutor.shutdown();
    }
  }
View Full Code Here

Examples of org.camunda.bpm.engine.impl.jobexecutor.JobExecutor

      jobExecutor.shutdown();
    }
  }

  public void waitForJobExecutorOnCondition(long maxMillisToWait, long intervalMillis, Callable<Boolean> condition) {
    JobExecutor jobExecutor = processEngineConfiguration.getJobExecutor();
    jobExecutor.start();

    try {
      Timer timer = new Timer();
      InteruptTask task = new InteruptTask(Thread.currentThread());
      timer.schedule(task, maxMillisToWait);
      boolean conditionIsViolated = true;
      try {
        while (conditionIsViolated) {
          Thread.sleep(intervalMillis);
          conditionIsViolated = !condition.call();
        }
      } catch (InterruptedException e) {
      } catch (Exception e) {
        throw new ProcessEngineException("Exception while waiting on condition: "+e.getMessage(), e);
      } finally {
        timer.cancel();
      }
      if (conditionIsViolated) {
        throw new ProcessEngineException("time limit of " + maxMillisToWait + " was exceeded");
      }

    } finally {
      jobExecutor.shutdown();
    }
  }
View Full Code Here

Examples of org.jbpm.job.executor.JobExecutor

  private JbpmConfiguration jbpmConfiguration;

  public void contextInitialized(ServletContextEvent event) {
    String jbpmCfgResource = event.getServletContext().getInitParameter("jbpm.configuration.resource");
    jbpmConfiguration = JbpmConfiguration.getInstance(jbpmCfgResource);
    JobExecutor jobExecutor = jbpmConfiguration.getJobExecutor();
    if (jobExecutor != null)
      jobExecutor.start();
  }
View Full Code Here

Examples of org.jbpm.job.executor.JobExecutor

    if (jobExecutor != null)
      jobExecutor.start();
  }

  public void contextDestroyed(ServletContextEvent event) {
    JobExecutor jobExecutor = jbpmConfiguration.getJobExecutor();
    if (jobExecutor != null)
      jobExecutor.stop();
  }
View Full Code Here

Examples of org.jbpm.job.executor.JobExecutor

    @Override
    protected void startService()
        throws Exception
    {
        final JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance() ;
        final JobExecutor jobExecutor = jbpmConfiguration.getJobExecutor() ;
        if (jobExecutor != null)
        {
            jobExecutor.start() ;
        }
        final JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext() ;
        jbpmContext.close() ;
        super.startService();
    }
View Full Code Here

Examples of org.jbpm.job.executor.JobExecutor

    protected void stopService()
        throws Exception
    {
        super.stopService();
        final JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance() ;
        final JobExecutor jobExecutor = jbpmConfiguration.getJobExecutor() ;
        if (jobExecutor != null)
        {
            jobExecutor.stopAndJoin() ;
        }
        jbpmConfiguration.close() ;
    }
View Full Code Here

Examples of org.jbpm.job.executor.JobExecutor

        if (isDebugEnabled)
        {
            logger.debug("Sent signal task to message service for token id " + tokenId + " from process instance " + processInstanceId) ;
        }
       
        final JobExecutor jobExecutor = jbpmContext.getJbpmConfiguration().getJobExecutor() ;
        if (jobExecutor != null)
        {
            final TransactionStrategy transactionStrategy = TransactionStrategy.getTransactionStrategy(true) ;
            try
            {
View Full Code Here

Examples of org.jbpm.job.executor.JobExecutor

    log.debug("saved job["+job.getId()+", "+job.getClass().getName()+"]");
    hasProducedJobs = true;
  }

  public void close() {
    JobExecutor jobExecutor = jbpmConfiguration.getJobExecutor();
    if ( (hasProducedJobs)
         && (jobExecutor!=null)
       ) {
      log.debug("messages were produced the jobExecutor will be signalled");
      synchronized(jobExecutor) {
        jobExecutor.notify();
      }
    }
  }
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.