Support decorating Callable's from the WorkQueue.Executor
The WorkQueue never supported Callable's but this will be needed as we
start using the failsafe [1] library from the high-availability plugin.
From my observation, failsafe will call decorateTask(Callable<V>, ...)
from some code paths.
Release-Notes: skip
Change-Id: I93f2d57c4b444e1117ec4b7ef3c6705eaa34831c
diff --git a/java/com/google/gerrit/server/git/WorkQueue.java b/java/com/google/gerrit/server/git/WorkQueue.java
index e8b7c62..714ba0f 100644
--- a/java/com/google/gerrit/server/git/WorkQueue.java
+++ b/java/com/google/gerrit/server/git/WorkQueue.java
@@ -45,6 +45,7 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
import java.util.concurrent.RunnableScheduledFuture;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
@@ -463,8 +464,9 @@
@Override
protected <V> RunnableScheduledFuture<V> decorateTask(
- Callable<V> callable, RunnableScheduledFuture<V> task) {
- throw new UnsupportedOperationException("Callable not implemented");
+ Callable<V> callable, RunnableScheduledFuture<V> r) {
+ FutureTask<V> ft = new FutureTask<>(callable);
+ return decorateTask(ft, r);
}
void remove(Task<?> task) {