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); }