dsmiley commented on code in PR #3249:
URL: https://github.com/apache/solr/pull/3249#discussion_r1986363412
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/BaseHttpClusterStateProvider.java:
##########
@@ -230,43 +214,41 @@ private SimpleOrderedMap<?> submitClusterStateRequest(
}
@Override
- public Set<String> getLiveNodes() {
+ public synchronized Set<String> getLiveNodes() {
+ // synchronized because there's no value in multiple doing this at the
same time
if (TimeUnit.SECONDS.convert((System.nanoTime() - liveNodesTimestamp),
TimeUnit.NANOSECONDS)
- > getCacheTimeout()) {
+ <= getCacheTimeout()) {
+ return this.liveNodes; // cached copy is fresh enough
+ }
+ if (liveNodes != null) { // thus we've fetched liveNodes previously
Review Comment:
I don't follow. `liveNodes != null` is only false in the initial state.
assuming getLiveNodes is successful, liveNodes will never be null again.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]