diff --git a/src/main/kotlin/org/opensearch/replication/task/shard/FollowerClusterStats.kt b/src/main/kotlin/org/opensearch/replication/task/shard/FollowerClusterStats.kt index 77cfb6720..d36dcb2fe 100644 --- a/src/main/kotlin/org/opensearch/replication/task/shard/FollowerClusterStats.kt +++ b/src/main/kotlin/org/opensearch/replication/task/shard/FollowerClusterStats.kt @@ -20,6 +20,7 @@ import org.opensearch.core.xcontent.ToXContentFragment import org.opensearch.core.xcontent.XContentBuilder import org.opensearch.common.xcontent.XContentType import org.opensearch.core.index.shard.ShardId +import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.atomic.AtomicLong class FollowerShardMetric { @@ -116,5 +117,6 @@ class FollowerShardMetric { @Singleton class FollowerClusterStats { - var stats :MutableMap = mutableMapOf() -} \ No newline at end of file + // ConcurrentHashMap: concurrent put/remove/get from multiple ShardReplicationTasks (issue #1660) + val stats: MutableMap = ConcurrentHashMap() +}