dsmiley commented on code in PR #2101:
URL: https://github.com/apache/solr/pull/2101#discussion_r1423477681


##########
solr/core/src/java/org/apache/solr/core/SolrCore.java:
##########
@@ -1899,6 +1899,18 @@ public boolean isClosed() {
     return refCount.get() <= 0;
   }
 
+  /**
+   * Whether this core is ready. Sometimes using {@link #isClosed()} might 
result in a deadlock due
+   * to the caller trying to eagerly open a new searcher via {@link 
#withSearcher(IOFunction)}
+   * during core init phase.
+   *
+   * <p>Like for example concurrently polling metrics collection via the 
registered gauges in {@link
+   * #initializeMetrics(SolrMetricsContext, String)}
+   */
+  public boolean isReady() {
+    return !isClosed() && newSearcherCounter.getCount() > 0;

Review Comment:
   also check that newSearcherCounter isn't null



##########
solr/core/src/java/org/apache/solr/core/SolrCore.java:
##########
@@ -1899,6 +1899,18 @@ public boolean isClosed() {
     return refCount.get() <= 0;
   }
 
+  /**
+   * Whether this core is ready. Sometimes using {@link #isClosed()} might 
result in a deadlock due
+   * to the caller trying to eagerly open a new searcher via {@link 
#withSearcher(IOFunction)}
+   * during core init phase.
+   *
+   * <p>Like for example concurrently polling metrics collection via the 
registered gauges in {@link
+   * #initializeMetrics(SolrMetricsContext, String)}

Review Comment:
   Personally, I think these docs are overly prescriptive based on our first 
need for this.  Really, the docs can be as simple as: "The core is ready for 
use.  It is not initializing or closing/closed.



-- 
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: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to