From 945ddd5c81c6eb6c1368fe0294bb4ad2f82297a5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Mon, 7 Dec 2015 10:10:45 +0100 Subject: [PATCH] SONAR-7088 rename CeWorkerRunnable to CeWorkerCallable --- .../CeProcessingSchedulerExecutorService.java | 2 +- .../taskprocessor/CeProcessingSchedulerImpl.java | 4 ++-- .../taskprocessor/CeTaskProcessorModule.java | 2 +- .../{CeWorkerRunnable.java => CeWorkerCallable.java} | 2 +- ...rkerRunnableImpl.java => CeWorkerCallableImpl.java} | 6 +++--- .../taskprocessor/CeProcessingSchedulerImplTest.java | 10 +++++----- ...ableImplTest.java => CeWorkerCallableImplTest.java} | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) rename server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/{CeWorkerRunnable.java => CeWorkerCallable.java} (95%) rename server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/{CeWorkerRunnableImpl.java => CeWorkerCallableImpl.java} (95%) rename server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/{CeWorkerRunnableImplTest.java => CeWorkerCallableImplTest.java} (97%) diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerExecutorService.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerExecutorService.java index 33d02bf48aa..76d062998b4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerExecutorService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerExecutorService.java @@ -23,7 +23,7 @@ import com.google.common.util.concurrent.ListeningScheduledExecutorService; import org.sonar.server.util.StoppableExecutorService; /** - * The {@link java.util.concurrent.ExecutorService} responsible for running {@link CeWorkerRunnableImpl}. + * The {@link java.util.concurrent.ExecutorService} responsible for running {@link CeWorkerCallableImpl}. */ public interface CeProcessingSchedulerExecutorService extends StoppableExecutorService, ListeningScheduledExecutorService { } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImpl.java index a5040317030..aa034173e8d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImpl.java @@ -38,14 +38,14 @@ public class CeProcessingSchedulerImpl implements CeProcessingScheduler, Startab private static final Logger LOG = Loggers.get(CeProcessingSchedulerImpl.class); private final CeProcessingSchedulerExecutorService executorService; - private final CeWorkerRunnable workerRunnable; + private final CeWorkerCallable workerRunnable; private final long delayBetweenTasks; private final TimeUnit timeUnit; // warning: using a single ChainingCallback object for chaining works and is thread safe only because we use a single Thread in CeProcessingSchedulerExecutorService private final ChainingCallback chainingCallback = new ChainingCallback(); - public CeProcessingSchedulerImpl(CeProcessingSchedulerExecutorService processingExecutorService, CeWorkerRunnable workerRunnable) { + public CeProcessingSchedulerImpl(CeProcessingSchedulerExecutorService processingExecutorService, CeWorkerCallable workerRunnable) { this.executorService = processingExecutorService; this.workerRunnable = workerRunnable; diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorModule.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorModule.java index 8ae68bd4789..77fd53627e5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorModule.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeTaskProcessorModule.java @@ -26,7 +26,7 @@ public class CeTaskProcessorModule extends Module { protected void configureModule() { add( CeTaskProcessorRepositoryImpl.class, - CeWorkerRunnableImpl.class, + CeWorkerCallableImpl.class, CeProcessingSchedulerExecutorServiceImpl.class, CeProcessingSchedulerImpl.class); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerRunnable.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallable.java similarity index 95% rename from server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerRunnable.java rename to server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallable.java index d6c8fb86b89..6c75a5e4070 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerRunnable.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallable.java @@ -26,5 +26,5 @@ import org.sonar.server.computation.queue.CeTask; /** * Marker interface of the runnable in charge of polling the {@link CeQueue} and executing {@link CeTask}. */ -public interface CeWorkerRunnable extends Callable { +public interface CeWorkerCallable extends Callable { } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerRunnableImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImpl.java similarity index 95% rename from server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerRunnableImpl.java rename to server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImpl.java index a7b28ee9367..091bb7cdc48 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerRunnableImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImpl.java @@ -31,15 +31,15 @@ import org.sonar.server.computation.queue.CeTask; import static java.lang.String.format; -public class CeWorkerRunnableImpl implements CeWorkerRunnable { +public class CeWorkerCallableImpl implements CeWorkerCallable { - private static final Logger LOG = Loggers.get(CeWorkerRunnableImpl.class); + private static final Logger LOG = Loggers.get(CeWorkerCallableImpl.class); private final CeQueue queue; private final CeLogging ceLogging; private final CeTaskProcessorRepository taskProcessorRepository; - public CeWorkerRunnableImpl(CeQueue queue, CeLogging ceLogging, CeTaskProcessorRepository taskProcessorRepository) { + public CeWorkerCallableImpl(CeQueue queue, CeLogging ceLogging, CeTaskProcessorRepository taskProcessorRepository) { this.queue = queue; this.ceLogging = ceLogging; this.taskProcessorRepository = taskProcessorRepository; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImplTest.java index 82b412fd43f..d2c33c422a0 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImplTest.java @@ -54,7 +54,7 @@ public class CeProcessingSchedulerImplTest { // due to risks of infinite chaining of tasks/futures, a timeout is required for safety public Timeout timeout = Timeout.seconds(60); - private CeWorkerRunnable ceWorkerRunnable = mock(CeWorkerRunnable.class); + private CeWorkerCallable ceWorkerRunnable = mock(CeWorkerCallable.class); private StubCeProcessingSchedulerExecutorService processingExecutorService = new StubCeProcessingSchedulerExecutorService(); private SchedulerCall regularDelayedPoll = new SchedulerCall(ceWorkerRunnable, 2L, TimeUnit.SECONDS); private SchedulerCall notDelayedPoll = new SchedulerCall(ceWorkerRunnable); @@ -62,7 +62,7 @@ public class CeProcessingSchedulerImplTest { private CeProcessingSchedulerImpl underTest = new CeProcessingSchedulerImpl(processingExecutorService, ceWorkerRunnable); @Test - public void polls_without_delay_when_CeWorkerRunnable_returns_true() throws Exception { + public void polls_without_delay_when_CeWorkerCallable_returns_true() throws Exception { when(ceWorkerRunnable.call()) .thenReturn(true) .thenThrow(ERROR_TO_INTERRUPT_CHAINING); @@ -76,7 +76,7 @@ public class CeProcessingSchedulerImplTest { } @Test - public void polls_without_delay_when_CeWorkerRunnable_throws_Exception_but_not_Error() throws Exception { + public void polls_without_delay_when_CeWorkerCallable_throws_Exception_but_not_Error() throws Exception { when(ceWorkerRunnable.call()) .thenThrow(new Exception("Exception is followed by a poll without delay")) .thenThrow(ERROR_TO_INTERRUPT_CHAINING); @@ -90,7 +90,7 @@ public class CeProcessingSchedulerImplTest { } @Test - public void polls_with_regular_delay_when_CeWorkerRunnable_returns_false() throws Exception { + public void polls_with_regular_delay_when_CeWorkerCallable_returns_false() throws Exception { when(ceWorkerRunnable.call()) .thenReturn(false) .thenThrow(ERROR_TO_INTERRUPT_CHAINING); @@ -104,7 +104,7 @@ public class CeProcessingSchedulerImplTest { } @Test - public void startScheduling_schedules_CeWorkerRunnable_at_fixed_rate_run_head_of_queue() throws Exception { + public void startScheduling_schedules_CeWorkerCallable_at_fixed_rate_run_head_of_queue() throws Exception { when(ceWorkerRunnable.call()) .thenReturn(true) .thenReturn(true) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeWorkerRunnableImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImplTest.java similarity index 97% rename from server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeWorkerRunnableImplTest.java rename to server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImplTest.java index 305c5e321d4..331ceaeac14 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeWorkerRunnableImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeWorkerCallableImplTest.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; -public class CeWorkerRunnableImplTest { +public class CeWorkerCallableImplTest { @Rule public CeTaskProcessorRepositoryRule taskProcessorRepository = new CeTaskProcessorRepositoryRule(); @@ -46,7 +46,7 @@ public class CeWorkerRunnableImplTest { CeQueue queue = mock(CeQueueImpl.class); ReportTaskProcessor taskProcessor = mock(ReportTaskProcessor.class); CeLogging ceLogging = mock(CeLogging.class); - CeWorkerRunnable underTest = new CeWorkerRunnableImpl(queue, ceLogging, taskProcessorRepository); + CeWorkerCallable underTest = new CeWorkerCallableImpl(queue, ceLogging, taskProcessorRepository); InOrder inOrder = Mockito.inOrder(ceLogging, taskProcessor, queue); @Test -- 2.39.5