Package io.lumify.core.model.longRunningProcess

Examples of io.lumify.core.model.longRunningProcess.LongRunningProcessRunner


            return;
        }

        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());
                            longRunningProcessMessage.complete();
                        } catch (Throwable ex) {
                            LOGGER.error("Failed to process long running process: %s", longRunningProcessMessage.getMessage());
                            longRunningProcessMessage.complete(ex);
                        }
View Full Code Here

TOP

Related Classes of io.lumify.core.model.longRunningProcess.LongRunningProcessRunner

Copyright © 2018 www.massapicom. 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.