Skip to content

Apache Lucene open-source search software

SOLR-8995: Replace anonymous implementations of SAM interfaces with Lambdas

Noble Paul09f92b7edf2c
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index 3e10efeb6bd..faac0a25cad 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -1822,25 +1822,22 @@ public final class SolrCore implements SolrInfoMBean, Closeable {
final RefCounted<SolrIndexSearcher> currSearcherHolderF = currSearcherHolder;
if (!alreadyRegistered) {
future = searcherExecutor.submit(
- new Callable() {
- @Override
- public Object call() throws Exception {
- try {
- // registerSearcher will decrement onDeckSearchers and
- // do a notify, even if it fails.
- registerSearcher(newSearchHolder);
- } catch (Throwable e) {
- SolrException.log(log, e);
- if (e instanceof Error) {
- throw (Error) e;
- }
- } finally {
- // we are all done with the old searcher we used
- // for warming...
- if (currSearcherHolderF!=null) currSearcherHolderF.decref();
+ () -> {
+ try {
+ // registerSearcher will decrement onDeckSearchers and
+ // do a notify, even if it fails.
+ registerSearcher(newSearchHolder);
+ } catch (Throwable e) {
+ SolrException.log(log, e);
+ if (e instanceof Error) {
+ throw (Error) e;
}
- return null;
+ } finally {
+ // we are all done with the old searcher we used
+ // for warming...
+ if (currSearcherHolderF!=null) currSearcherHolderF.decref();
}
+ return null;
}
);
}