Search in sources :

Example 16 with ProcessEngineConfiguration

use of org.activiti.engine.ProcessEngineConfiguration in project Activiti by Activiti.

the class JobEntityManager method findNextTimerJobsToExecute.

@SuppressWarnings("unchecked")
public List<JobEntity> findNextTimerJobsToExecute(Page page) {
    ProcessEngineConfiguration processEngineConfig = Context.getProcessEngineConfiguration();
    Date now = processEngineConfig.getClock().getCurrentTime();
    return getDbSqlSession().selectList("selectNextTimerJobsToExecute", now, page);
}
Also used : ProcessEngineConfiguration(org.activiti.engine.ProcessEngineConfiguration) Date(java.util.Date)

Example 17 with ProcessEngineConfiguration

use of org.activiti.engine.ProcessEngineConfiguration in project Activiti by Activiti.

the class JobEntityManager method findAsyncJobsDueToExecute.

@SuppressWarnings("unchecked")
public List<JobEntity> findAsyncJobsDueToExecute(Page page) {
    ProcessEngineConfiguration processEngineConfig = Context.getProcessEngineConfiguration();
    Date now = processEngineConfig.getClock().getCurrentTime();
    return getDbSqlSession().selectList("selectAsyncJobsDueToExecute", now, page);
}
Also used : ProcessEngineConfiguration(org.activiti.engine.ProcessEngineConfiguration) Date(java.util.Date)

Example 18 with ProcessEngineConfiguration

use of org.activiti.engine.ProcessEngineConfiguration in project Activiti by Activiti.

the class JobEntityManager method findNextJobsToExecute.

@SuppressWarnings("unchecked")
public List<JobEntity> findNextJobsToExecute(Page page) {
    ProcessEngineConfiguration processEngineConfig = Context.getProcessEngineConfiguration();
    Date now = processEngineConfig.getClock().getCurrentTime();
    return getDbSqlSession().selectList("selectNextJobsToExecute", now, page);
}
Also used : ProcessEngineConfiguration(org.activiti.engine.ProcessEngineConfiguration) Date(java.util.Date)

Example 19 with ProcessEngineConfiguration

use of org.activiti.engine.ProcessEngineConfiguration in project Activiti by Activiti.

the class JobExecutorJMXClientTest method testJobExecutorJMXClient.

@Test
public void testJobExecutorJMXClient() throws InterruptedException, IOException, MalformedObjectNameException, AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException {
    String hostName = Utils.getHostName();
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://" + hostName + ":10111/jndi/rmi://" + hostName + ":1099/jmxrmi/activiti");
    ProcessEngineConfiguration processEngineConfig = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml");
    processEngineConfig.buildProcessEngine();
    // wait for jmx server to come up
    Thread.sleep(500);
    JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
    MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
    ObjectName jobExecutorBeanName = new ObjectName("org.activiti.jmx.Mbeans:type=JobExecutor");
    processEngineConfig.getJobExecutor().shutdown();
    // first check that job executor is not activated and correctly reported as being inactive
    assertFalse(processEngineConfig.isJobExecutorActivate());
    assertFalse((Boolean) mbsc.getAttribute(jobExecutorBeanName, "JobExecutorActivated"));
    // now activate it remotely
    mbsc.invoke(jobExecutorBeanName, "setJobExecutorActivate", new Boolean[] { true }, new String[] { Boolean.class.getName() });
    // check if it has the effect and correctly reported
    //    assertTrue(processEngineConfig.getJobExecutor().isActive());
    assertTrue((Boolean) mbsc.getAttribute(jobExecutorBeanName, "JobExecutorActivated"));
    //agani disable and check it    
    mbsc.invoke(jobExecutorBeanName, "setJobExecutorActivate", new Boolean[] { false }, new String[] { Boolean.class.getName() });
    // check if it has the effect and correctly reported
    assertFalse(processEngineConfig.isJobExecutorActivate());
    assertFalse((Boolean) mbsc.getAttribute(jobExecutorBeanName, "JobExecutorActivated"));
}
Also used : JMXServiceURL(javax.management.remote.JMXServiceURL) ProcessEngineConfiguration(org.activiti.engine.ProcessEngineConfiguration) JMXConnector(javax.management.remote.JMXConnector) MBeanServerConnection(javax.management.MBeanServerConnection) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 20 with ProcessEngineConfiguration

use of org.activiti.engine.ProcessEngineConfiguration in project Activiti by Activiti.

the class Main method createJobCreatorProcessEngine.

private static void createJobCreatorProcessEngine(boolean replaceExisting, boolean isDropDatabaseSchema) {
    if (processEngine == null || replaceExisting) {
        System.out.println("Creating process engine with config activiti_job_creator.cfg.xml. Dropping db first = " + isDropDatabaseSchema);
        ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti_job_creator.cfg.xml");
        if (isDropDatabaseSchema) {
            processEngineConfiguration.setDatabaseSchemaUpdate("drop-create");
        }
        processEngine = processEngineConfiguration.buildProcessEngine();
    }
}
Also used : ProcessEngineConfiguration(org.activiti.engine.ProcessEngineConfiguration)

Aggregations

ProcessEngineConfiguration (org.activiti.engine.ProcessEngineConfiguration)24 ProcessEngine (org.activiti.engine.ProcessEngine)7 Test (org.junit.Test)7 Date (java.util.Date)4 ProcessEngineImpl (org.activiti.engine.impl.ProcessEngineImpl)4 ProcessDiagramGenerator (org.activiti.image.ProcessDiagramGenerator)4 StreamResource (com.vaadin.terminal.StreamResource)3 Embedded (com.vaadin.ui.Embedded)3 HorizontalLayout (com.vaadin.ui.HorizontalLayout)2 Label (com.vaadin.ui.Label)2 Panel (com.vaadin.ui.Panel)2 URL (java.net.URL)2 GregorianCalendar (java.util.GregorianCalendar)2 MBeanServerConnection (javax.management.MBeanServerConnection)2 ObjectName (javax.management.ObjectName)2 JMXConnector (javax.management.remote.JMXConnector)2 JMXServiceURL (javax.management.remote.JMXServiceURL)2 ActivitiException (org.activiti.engine.ActivitiException)2 RepositoryService (org.activiti.engine.RepositoryService)2 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)2