noblepaul commented on a change in pull request #2187: URL: https://github.com/apache/lucene-solr/pull/2187#discussion_r554584632
########## File path: solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java ########## @@ -420,5 +435,63 @@ public String toString() { public int size() { return collectionStates.size(); } + interface ReplicaStatesProvider { + + Optional<ReplicaStatesProvider> get(); + + PerReplicaStates getStates(); + + } + + private static final ReplicaStatesProvider EMPTYSTATEPROVIDER = new ReplicaStatesProvider() { + @Override + public Optional<ReplicaStatesProvider> get() { + return Optional.empty(); + } + + @Override + public PerReplicaStates getStates() { + throw new RuntimeException("Invalid operation"); + } + + }; + + private static ThreadLocal<ReplicaStatesProvider> REPLICASTATES_PROVIDER = new ThreadLocal<>(); + + + public static ReplicaStatesProvider getReplicaStatesProvider() { + return (REPLICASTATES_PROVIDER.get() == null)? EMPTYSTATEPROVIDER: REPLICASTATES_PROVIDER.get() ; + } + public static void initReplicaStateProvider(Supplier<PerReplicaStates> replicaStatesSupplier) { Review comment: It's not about concurrency. It was just one option ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org