private void afterExecute() { localRunningState.setTask(null); finalizeTask(task, ceProfiler, status, taskResult, error); }
private void beforeExecute() { localRunningState.setTask(task); callListeners(t -> t.onStart(task)); }
private void chainWithoutDelay() { workerFuture = executorService.submit(worker); addCallback(); }
private void chainWithDisabledTaskDelay() { workerFuture = executorService.schedule(worker, DELAY_BETWEEN_DISABLED_TASKS, timeUnit); addCallback(); }
@Test public void constructor_throws_IAE_if_two_TaskProcessor_handle_the_same_CeTask_type() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage( "There can be only one CeTaskProcessor instance registered as the processor for CeTask type " + SOME_CE_TASK_TYPE + ". " + "More than one found. Please fix your configuration: " + SomeProcessor1.class.getName() + ", " + SomeProcessor2.class.getName()); new CeTaskProcessorRepositoryImpl(new CeTaskProcessor[] { new SomeProcessor1(SOME_CE_TASK_TYPE), new SomeProcessor2(SOME_CE_TASK_TYPE) }); }
@Override protected void configureModule() { add( CeTaskProcessorRepositoryImpl.class, CeLoggingWorkerExecutionListener.class, ReportAnalysisFailureNotificationExecutionListener.class, new CeTaskInterrupterProvider(), CeTaskInterrupterWorkerExecutionListener.class, CeWorkerFactoryImpl.class, CeWorkerControllerImpl.class, CeProcessingSchedulerExecutorServiceImpl.class, CeProcessingSchedulerImpl.class ); } }
@Override public void run() { beforeExecute(); executeTask(); }
@Override public Result call() { try (TrackRunningState trackRunningState = new TrackRunningState(this::findAndProcessTask)) { return trackRunningState.get(); } }
public CeTaskProcessorRepositoryImpl(CeTaskProcessor[] taskProcessors) { this.taskProcessorByCeTaskType = indexTaskProcessors(taskProcessors); }
private void startSchedulingAndRun() throws ExecutionException, InterruptedException { underTest.startScheduling(); // execute future synchronously processingExecutorService.runFutures(); }
private Thread createThreadNameVerifyingThread(String threadName) { return new Thread(() -> { verifyUnchangedThreadName(threadName); try { underTest.call(); } catch (Exception e) { throw new RuntimeException(e); } verifyUnchangedThreadName(threadName); }, threadName); }
@Override public void close() { afterExecute(); }
public CeWorkerControllerImpl(CeConfiguration ceConfiguration) { this.ceConfiguration = ceConfiguration; logEnabledWorkerCount(); }
@Override public ProcessingRecorderHook registerProcessingFor(CeWorker ceWorker) { return new ProcessingRecorderHookImpl(ceWorker); }
private CeTaskProcessor createCeTaskProcessor(final String... ceTaskTypes) { return new HandleTypeOnlyTaskProcessor(ceTaskTypes); }
public ComputingThread(String name) { setName(name); }
private void chainWithEnabledTaskDelay() { workerFuture = executorService.schedule(worker, delayBetweenEnabledTasks, timeUnit); addCallback(); }
@Test public void constructor_throws_IAE_if_multiple_TaskProcessor_overlap_their_supported_CeTask_type() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage( "There can be only one CeTaskProcessor instance registered as the processor for CeTask type " + SOME_CE_TASK_TYPE + ". " + "More than one found. Please fix your configuration: " + SomeProcessor1.class.getName() + ", " + SomeProcessor2.class.getName()); new CeTaskProcessorRepositoryImpl(new CeTaskProcessor[] { new SomeProcessor2(SOME_CE_TASK_TYPE + "_2", SOME_CE_TASK_TYPE), new SomeProcessor1(SOME_CE_TASK_TYPE, SOME_CE_TASK_TYPE + "_3") }); }
@Override public void run() { for (int i = 2; i < 50; i++) { fibo(i); if (kill) { break; } } }