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

This commit is contained in:
Noble Paul 2016-04-15 19:03:22 +05:30
parent a07a8499d3
commit 09f92b7edf
1 changed files with 14 additions and 17 deletions

View File

@ -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;
}
);
}