Pass interceptor to super constructor (#876)

Signed-off-by: Sooraj Sinha <soosinha@amazon.com>
This commit is contained in:
Sooraj Sinha 2021-07-05 11:13:36 +05:30 committed by GitHub
parent 2d1a1e6234
commit a428e6f043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View File

@ -114,7 +114,7 @@ public abstract class AbstractAsyncBulkByScrollAction<Request extends AbstractBu
protected final ThreadPool threadPool;
protected final ScriptService scriptService;
protected final ReindexSslConfig sslConfig;
protected Optional<HttpRequestInterceptor> interceptor;
protected final Optional<HttpRequestInterceptor> interceptor;
/**
* The request for this action. Named mainRequest because we create lots of <code>request</code> variables all representing child
@ -138,10 +138,19 @@ public abstract class AbstractAsyncBulkByScrollAction<Request extends AbstractBu
private final BiFunction<RequestWrapper<?>, ScrollableHitSource.Hit, RequestWrapper<?>> scriptApplier;
private int lastBatchSize;
AbstractAsyncBulkByScrollAction(BulkByScrollTask task, boolean needsSourceDocumentVersions,
boolean needsSourceDocumentSeqNoAndPrimaryTerm, Logger logger, ParentTaskAssigningClient client,
ThreadPool threadPool, Request mainRequest, ActionListener<BulkByScrollResponse> listener,
@Nullable ScriptService scriptService, @Nullable ReindexSslConfig sslConfig) {
this(task, needsSourceDocumentVersions, needsSourceDocumentSeqNoAndPrimaryTerm, logger, client,
threadPool, mainRequest, listener, scriptService, sslConfig, Optional.empty());
}
AbstractAsyncBulkByScrollAction(BulkByScrollTask task, boolean needsSourceDocumentVersions,
boolean needsSourceDocumentSeqNoAndPrimaryTerm, Logger logger, ParentTaskAssigningClient client,
ThreadPool threadPool, Request mainRequest, ActionListener<BulkByScrollResponse> listener,
@Nullable ScriptService scriptService, @Nullable ReindexSslConfig sslConfig) {
@Nullable ScriptService scriptService, @Nullable ReindexSslConfig sslConfig,
Optional<HttpRequestInterceptor> interceptor) {
this.task = task;
this.scriptService = scriptService;
this.sslConfig = sslConfig;
@ -155,7 +164,7 @@ public abstract class AbstractAsyncBulkByScrollAction<Request extends AbstractBu
this.threadPool = threadPool;
this.mainRequest = mainRequest;
this.listener = listener;
this.interceptor = Optional.empty();
this.interceptor = interceptor;
BackoffPolicy backoffPolicy = buildBackoffPolicy();
bulkRetry = new Retry(BackoffPolicy.wrap(backoffPolicy, worker::countBulkRetry), threadPool);
scrollSource = buildScrollableResultSource(backoffPolicy);

View File

@ -238,8 +238,7 @@ public class Reindexer {
* external versioning.
*/
request.getDestination().versionType() != VersionType.INTERNAL,
false, logger, client, threadPool, request, listener, scriptService, sslConfig);
this.interceptor = interceptor;
false, logger, client, threadPool, request, listener, scriptService, sslConfig, interceptor);
}
@Override