int threadCount = Integer.parseInt(config.get(Configuration.LONG_RUNNING_PROCESS_RUNNER_THREAD_COUNT, "4"));
final LongRunningProcessRunner longRunningProcessRunner = InjectHelper.getInstance(LongRunningProcessRunner.class);
longRunningProcessRunner.prepare(config.toMap());
final WorkQueueRepository workQueueRepository = InjectHelper.getInstance(WorkQueueRepository.class);
for (int i = 0; i < threadCount; i++) {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
WorkQueueRepository.LongRunningProcessMessage longRunningProcessMessage = workQueueRepository.getNextLongRunningProcessMessage();
if (longRunningProcessMessage == null) {
continue;
}
try {
longRunningProcessRunner.process(longRunningProcessMessage.getMessage());