Simplify @ReceiveCommitsExecutor to ExecutorService

This doesn't need scheduling support, so the type should be just
ExecutorService, as it offers a wider class of implementations.

Change-Id: Ibbf573ad18058261cd2c73b31fce6703a817616f
This commit is contained in:
Shawn Pearce 2017-07-03 11:11:51 -07:00
parent e152099ad0
commit 19f9f92a59
3 changed files with 6 additions and 7 deletions

View File

@ -29,7 +29,7 @@ import com.google.inject.name.Named;
import java.io.OutputStream;
import java.util.Collection;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Repository;
@ -125,7 +125,7 @@ public class AsyncReceiveCommits implements PreReceiveHook {
}
private final ReceiveCommits rc;
private final ScheduledExecutorService executor;
private final ExecutorService executor;
private final RequestScopePropagator scopePropagator;
private final MultiProgressMonitor progress;
private final long timeoutMillis;
@ -133,7 +133,7 @@ public class AsyncReceiveCommits implements PreReceiveHook {
@Inject
AsyncReceiveCommits(
ReceiveCommits.Factory factory,
@ReceiveCommitsExecutor ScheduledExecutorService executor,
@ReceiveCommitsExecutor ExecutorService executor,
RequestScopePropagator scopePropagator,
@Named(TIMEOUT_NAME) long timeoutMillis,
@Assisted ProjectControl projectControl,

View File

@ -18,9 +18,9 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
import com.google.inject.BindingAnnotation;
import java.lang.annotation.Retention;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ExecutorService;
/** Marker on the global {@link ScheduledThreadPoolExecutor} used by {@link ReceiveCommits}. */
/** Marker on the global {@link ExecutorService} used by {@link ReceiveCommits}. */
@Retention(RUNTIME)
@BindingAnnotation
public @interface ReceiveCommitsExecutor {}

View File

@ -24,7 +24,6 @@ import com.google.inject.Provides;
import com.google.inject.Singleton;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.eclipse.jgit.lib.Config;
@ -37,7 +36,7 @@ public class ReceiveCommitsExecutorModule extends AbstractModule {
@Provides
@Singleton
@ReceiveCommitsExecutor
public ScheduledExecutorService createReceiveCommitsExecutor(
public ExecutorService createReceiveCommitsExecutor(
@GerritServerConfig Config config, WorkQueue queues) {
int poolSize =
config.getInt(