Search in sources :

Example 1 with ExecuteAsyncRunnable

use of org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable in project Activiti by Activiti.

the class HazelCastDistributedQueueBasedAsyncExecutor method initJobQueueListener.

protected void initJobQueueListener() {
    jobQueueListenerThread = new Thread(new Runnable() {

        public void run() {
            while (isActive) {
                JobEntity job = null;
                try {
                    // Blocking
                    job = jobQueue.take();
                } catch (InterruptedException e1) {
                    logger.info("jobQueueListenerThread interrupted. This is fine if the job executor is shutting down");
                // Do nothing, this can happen when shutting down
                } catch (HazelcastInstanceNotActiveException notActiveException) {
                    logger.info("Hazel cast not active exception caught. This is fine if the job executor is shutting down");
                }
                if (job != null) {
                    executorService.execute(new ExecuteAsyncRunnable(job, commandExecutor));
                }
            }
        }
    });
    jobQueueListenerThread.start();
}
Also used : JobEntity(org.activiti.engine.impl.persistence.entity.JobEntity) HazelcastInstanceNotActiveException(com.hazelcast.core.HazelcastInstanceNotActiveException) ExecuteAsyncRunnable(org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable) ExecuteAsyncRunnable(org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable)

Aggregations

HazelcastInstanceNotActiveException (com.hazelcast.core.HazelcastInstanceNotActiveException)1 ExecuteAsyncRunnable (org.activiti.engine.impl.asyncexecutor.ExecuteAsyncRunnable)1 JobEntity (org.activiti.engine.impl.persistence.entity.JobEntity)1