use of org.jbpm.executor.impl.concurrent.LoadAndScheduleRequestsTask in project jbpm by kiegroup.
the class ExecutorImpl method init.
/**
* {@inheritDoc}
*/
public void init() {
if (!"true".equalsIgnoreCase(System.getProperty("org.kie.executor.disabled"))) {
logger.info("Starting jBPM Executor Component ...\n" + " \t - Thread Pool Size: {}" + "\n" + " \t - Retries per Request: {}\n" + " \t - Load from storage interval: {} {} (if less or equal 0 only initial sync with storage) \n", threadPoolSize, retries, interval, timeunit.toString());
scheduler = getScheduledExecutorService();
if (useJMS) {
try {
InitialContext ctx = new InitialContext();
if (this.connectionFactory == null) {
this.connectionFactory = (ConnectionFactory) ctx.lookup(connectionFactoryName);
}
if (this.queue == null) {
this.queue = (Queue) ctx.lookup(queueName);
}
logger.info("Executor JMS based support successfully activated on queue {}", queue);
} catch (Exception e) {
logger.warn("Disabling JMS support in executor because: unable to initialize JMS configuration for executor due to {}", e.getMessage());
logger.debug("JMS support executor failed due to {}", e.getMessage(), e);
// since it cannot be initialized disable jms
useJMS = false;
}
}
LoadAndScheduleRequestsTask loadTask = new LoadAndScheduleRequestsTask(executorStoreService, scheduler, jobProcessor);
if (interval <= 0) {
scheduler.execute(loadTask);
} else {
logger.info("Interval ({}) is more than 0, scheduling periodic load of jobs from the storage", interval);
loadTaskFuture = scheduler.scheduleAtFixedRate(loadTask, 0, interval, timeunit);
}
} else {
throw new ExecutorNotStartedException();
}
}
Aggregations