magibney commented on a change in pull request #592:
URL: https://github.com/apache/solr/pull/592#discussion_r838856353



##########
File path: solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
##########
@@ -118,10 +122,22 @@
   private final int queryResultMaxDocsCached;
   private final boolean useFilterForSortedQuery;
 
+  /** Special-case cache to handle the lazy-init of {@link #liveDocs}. */
+  @SuppressWarnings({"unchecked", "rawtypes"})
+  private final CompletableFuture<BitDocSet>[] liveDocsCache = new 
CompletableFuture[1];

Review comment:
       Both SuppressWarnings are necessary with the 
"internal-one-element-array-for-synchromization" approach, because of the 
inability to do parameterized array creation. Is there another alternative that 
I'm missing there?
   
   I'd be ok with Future if you prefer; the only benefit I can see to 
CompletableFuture on the instance variable (which is private, so arguably is 
itself an implementation detail, albeit in a very large class 
:slightly_smiling_face:) is that it provides the `join()` method to get the 
computation results without forcing us to explicitly handle checked exceptions 
from the `get()` method.




-- 
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