Evaluator: Replace ScheduledThreadPoolExecutor use with ExecutorService
Fix the loading of this plugin in a gerrit site, namely the adaptation
started with change Ib023c65cd.
Before this current change, plugin loading failed with the binding error
described in the Issue below.
Bug: Issue 12738
Change-Id: Ie4cdc8ea9e114613ce739a768d884c6e214cf053
diff --git a/src/main/java/com/ericsson/gerrit/plugins/gcconductor/evaluator/Evaluator.java b/src/main/java/com/ericsson/gerrit/plugins/gcconductor/evaluator/Evaluator.java
index 5ae7fac..eda5f96 100644
--- a/src/main/java/com/ericsson/gerrit/plugins/gcconductor/evaluator/Evaluator.java
+++ b/src/main/java/com/ericsson/gerrit/plugins/gcconductor/evaluator/Evaluator.java
@@ -31,8 +31,8 @@
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.ObjectId;
@@ -48,7 +48,7 @@
private static final Logger log = LoggerFactory.getLogger(Evaluator.class);
private static final ThreadLocal<String> uploadRepositoryPath = new ThreadLocal<String>() {};
- private final ScheduledThreadPoolExecutor executor;
+ private final ExecutorService executor;
private final EvaluationTask.Factory evaluationTaskFactory;
private final GitRepositoryManager repoManager;
private final Map<String, Long> timestamps;
@@ -59,7 +59,7 @@
@Inject
Evaluator(
- @EvaluatorExecutor ScheduledThreadPoolExecutor executor,
+ @EvaluatorExecutor ExecutorService executor,
EvaluationTask.Factory evaluationTaskFactory,
GitRepositoryManager repoManager,
EvaluatorConfig config,
diff --git a/src/test/java/com/ericsson/gerrit/plugins/gcconductor/evaluator/EvaluatorTest.java b/src/test/java/com/ericsson/gerrit/plugins/gcconductor/evaluator/EvaluatorTest.java
index 7dc403b..c51d2a8 100644
--- a/src/test/java/com/ericsson/gerrit/plugins/gcconductor/evaluator/EvaluatorTest.java
+++ b/src/test/java/com/ericsson/gerrit/plugins/gcconductor/evaluator/EvaluatorTest.java
@@ -29,7 +29,7 @@
import java.io.File;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ExecutorService;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Repository;
@@ -49,7 +49,7 @@
@Mock private GitRepositoryManager repoManager;
@Mock private Repository repository;
@Mock private Repository repositoryOther;
- @Mock private ScheduledThreadPoolExecutor executor;
+ @Mock private ExecutorService executor;
@Mock private EvaluatorConfig config;
@Mock private Config gerritConfig;