ben-manes commented on pull request #230:
URL: https://github.com/apache/solr/pull/230#issuecomment-888786654


   The common pool is a nice default, but due to blocking I/O it is easy for 
the workers to be saturated and the system idle. You might want a dedicated 
pool to avoid surprising degradations due to foreign code's usage of this 
shared resource. Otherwise, if you wanted to avoid running the future on a 
thread pool and use a caller thread, you could complete the future manually 
using a similar pattern to your original code.
   
   ```java
   var future = new CompletableFuture<V>();
   var result = asyncCache.asMap().putIfAbsent(key, future);
   if (result != null) {
     return result.join();
   }
   try {
     V value = // do work
     future.complete(value);
     return value;
   } catch (Throwable t) {
     future.completeExceptionally(t);
     throw t;
   }
   ```


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