From 33564c3a5d9936c45b78fb4e60d01b3e0f4de7a4 Mon Sep 17 00:00:00 2001 From: Rishikesh1159 Date: Wed, 22 Jun 2022 22:25:05 +0000 Subject: [PATCH] Removing CheckpointPublisherProvider in IndicesModule Signed-off-by: Rishikesh1159 --- .../org/opensearch/indices/IndicesModule.java | 23 +------------------ ...SegmentReplicationCheckpointPublisher.java | 2 ++ 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/server/src/main/java/org/opensearch/indices/IndicesModule.java b/server/src/main/java/org/opensearch/indices/IndicesModule.java index e7aa79d817ede..51271b002a66f 100644 --- a/server/src/main/java/org/opensearch/indices/IndicesModule.java +++ b/server/src/main/java/org/opensearch/indices/IndicesModule.java @@ -284,33 +284,12 @@ protected void configure() { bind(RetentionLeaseBackgroundSyncAction.class).asEagerSingleton(); bind(RetentionLeaseSyncer.class).asEagerSingleton(); if (FeatureFlags.isEnabled(FeatureFlags.REPLICATION_TYPE)) { - bind(SegmentReplicationCheckpointPublisher.class).toProvider(CheckpointPublisherProvider.class).asEagerSingleton(); + bind(SegmentReplicationCheckpointPublisher.class).asEagerSingleton(); } else { bind(SegmentReplicationCheckpointPublisher.class).toInstance(SegmentReplicationCheckpointPublisher.EMPTY); } } - /** - * This provider is necessary while segment replication is behind a feature flag. - * We don't want to initialize a PublishCheckpointAction with the feature flag disabled. - * - * @opensearch.internal - */ - public final static class CheckpointPublisherProvider implements Provider { - - private final PublishCheckpointAction action; - - @Inject - public CheckpointPublisherProvider(PublishCheckpointAction action) { - this.action = action; - } - - @Override - public SegmentReplicationCheckpointPublisher get() { - return new SegmentReplicationCheckpointPublisher(action); - } - } - /** * A registry for all field mappers. */ diff --git a/server/src/main/java/org/opensearch/indices/replication/checkpoint/SegmentReplicationCheckpointPublisher.java b/server/src/main/java/org/opensearch/indices/replication/checkpoint/SegmentReplicationCheckpointPublisher.java index 39b7a6fef1abd..6be524cea140e 100644 --- a/server/src/main/java/org/opensearch/indices/replication/checkpoint/SegmentReplicationCheckpointPublisher.java +++ b/server/src/main/java/org/opensearch/indices/replication/checkpoint/SegmentReplicationCheckpointPublisher.java @@ -8,6 +8,7 @@ package org.opensearch.indices.replication.checkpoint; +import org.opensearch.common.inject.Inject; import org.opensearch.index.shard.IndexShard; import java.util.Objects; @@ -22,6 +23,7 @@ public class SegmentReplicationCheckpointPublisher { private final PublishAction publishAction; // This Component is behind feature flag so we are manually binding this in IndicesModule. + @Inject public SegmentReplicationCheckpointPublisher(PublishCheckpointAction publishAction) { this(publishAction::publish); }