Module org.apache.lucene.core
Package org.apache.lucene.search
Class IndexSearcher.CachingLeafSlicesSupplier
java.lang.Object
org.apache.lucene.search.IndexSearcher.CachingLeafSlicesSupplier
- All Implemented Interfaces:
Supplier<IndexSearcher.LeafSlice[]>
- Enclosing class:
IndexSearcher
private static class IndexSearcher.CachingLeafSlicesSupplier
extends Object
implements Supplier<IndexSearcher.LeafSlice[]>
Supplier for
IndexSearcher.LeafSlice
slices which computes and caches the value on first invocation
and returns cached value on subsequent invocation. If the passed in provider for slice
computation throws exception then same will be passed to the caller of this supplier on each
invocation. If the provider returns null then NullPointerException
will be thrown to
the caller.
NOTE: To provide thread safe caching mechanism this class is implementing the (subtle) double-checked locking idiom
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate IndexSearcher.LeafSlice[]
private final List
<LeafReaderContext> private final Function
<List<LeafReaderContext>, IndexSearcher.LeafSlice[]> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
CachingLeafSlicesSupplier
(Function<List<LeafReaderContext>, IndexSearcher.LeafSlice[]> provider, List<LeafReaderContext> leaves) -
Method Summary
-
Field Details
-
leafSlices
-
sliceProvider
-
leaves
-
-
Constructor Details
-
CachingLeafSlicesSupplier
private CachingLeafSlicesSupplier(Function<List<LeafReaderContext>, IndexSearcher.LeafSlice[]> provider, List<LeafReaderContext> leaves)
-
-
Method Details
-
get
- Specified by:
get
in interfaceSupplier<IndexSearcher.LeafSlice[]>
-