Rename EmailReviewCommentsExecutor to SendEmailExecutor
The executor was already used to send email for other reason than review comments. Rename it so it's more explicit that this executor can be used to send any email asynchronously. Change-Id: If5d5b59124bf44b4cbdda61536bfb50e8353285e
This commit is contained in:
committed by
David Pursehouse
parent
0338f88472
commit
d220a8ae57
@@ -24,7 +24,7 @@ import com.google.gerrit.reviewdb.client.PatchLineComment;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.server.ReviewDb;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.git.EmailReviewCommentsExecutor;
|
||||
import com.google.gerrit.server.git.SendEmailExecutor;
|
||||
import com.google.gerrit.server.mail.CommentSender;
|
||||
import com.google.gerrit.server.patch.PatchSetInfoFactory;
|
||||
import com.google.gerrit.server.util.RequestContext;
|
||||
@@ -72,7 +72,7 @@ public class EmailReviewComments implements Runnable, RequestContext {
|
||||
|
||||
@Inject
|
||||
EmailReviewComments (
|
||||
@EmailReviewCommentsExecutor ExecutorService executor,
|
||||
@SendEmailExecutor ExecutorService executor,
|
||||
PatchSetInfoFactory patchSetInfoFactory,
|
||||
CommentSender.Factory commentSenderFactory,
|
||||
SchemaFactory<ReviewDb> schemaFactory,
|
||||
|
||||
@@ -52,7 +52,7 @@ public class EmailMerge implements Runnable, RequestContext {
|
||||
private ReviewDb db;
|
||||
|
||||
@Inject
|
||||
EmailMerge(@EmailReviewCommentsExecutor ExecutorService executor,
|
||||
EmailMerge(@SendEmailExecutor ExecutorService executor,
|
||||
MergedSender.Factory mergedSenderFactory,
|
||||
SchemaFactory<ReviewDb> schemaFactory,
|
||||
ThreadLocalRequestContext requestContext,
|
||||
|
||||
@@ -48,14 +48,14 @@ public class ReceiveCommitsExecutorModule extends AbstractModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@EmailReviewCommentsExecutor
|
||||
public ExecutorService createEmailReviewCommentsExecutor(
|
||||
@SendEmailExecutor
|
||||
public ExecutorService createSendEmailExecutor(
|
||||
@GerritServerConfig Config config, WorkQueue queues) {
|
||||
int poolSize = config.getInt("sendemail", null, "threadPoolSize", 1);
|
||||
if (poolSize == 0) {
|
||||
return MoreExecutors.newDirectExecutorService();
|
||||
}
|
||||
return queues.createQueue(poolSize, "EmailReviewComments");
|
||||
return queues.createQueue(poolSize, "SendEmail");
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@@ -16,16 +16,14 @@ package com.google.gerrit.server.git;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import com.google.gerrit.server.change.EmailReviewComments;
|
||||
import com.google.inject.BindingAnnotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
/**
|
||||
* Marker on the global {@link WorkQueue.Executor} used by
|
||||
* {@link EmailReviewComments}.
|
||||
* Marker on the global {@link WorkQueue.Executor} used to send email.
|
||||
*/
|
||||
@Retention(RUNTIME)
|
||||
@BindingAnnotation
|
||||
public @interface EmailReviewCommentsExecutor {
|
||||
public @interface SendEmailExecutor {
|
||||
}
|
||||
@@ -43,10 +43,10 @@ import com.google.gerrit.server.config.SitePath;
|
||||
import com.google.gerrit.server.config.TrackingFooters;
|
||||
import com.google.gerrit.server.config.TrackingFootersProvider;
|
||||
import com.google.gerrit.server.git.ChangeCacheImplModule;
|
||||
import com.google.gerrit.server.git.EmailReviewCommentsExecutor;
|
||||
import com.google.gerrit.server.git.GarbageCollection;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.gerrit.server.git.PerThreadRequestScope;
|
||||
import com.google.gerrit.server.git.SendEmailExecutor;
|
||||
import com.google.gerrit.server.index.ChangeSchemas;
|
||||
import com.google.gerrit.server.index.IndexModule.IndexType;
|
||||
import com.google.gerrit.server.mail.SignedTokenEmailTokenVerifier;
|
||||
@@ -212,8 +212,8 @@ public class InMemoryModule extends FactoryModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@EmailReviewCommentsExecutor
|
||||
public ExecutorService createEmailReviewCommentsExecutor() {
|
||||
@SendEmailExecutor
|
||||
public ExecutorService createSendEmailExecutor() {
|
||||
return MoreExecutors.newDirectExecutorService();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user