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:
java.util.function.Supplier<IndexSearcher.LeafSlice[]>
- Enclosing class:
- IndexSearcher
private static class IndexSearcher.CachingLeafSlicesSupplier extends java.lang.Object implements java.util.function.Supplier<IndexSearcher.LeafSlice[]>
Supplier forIndexSearcher.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 thenNullPointerException
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
Fields Modifier and Type Field Description private IndexSearcher.LeafSlice[]
leafSlices
private java.util.List<LeafReaderContext>
leaves
private java.util.function.Function<java.util.List<LeafReaderContext>,IndexSearcher.LeafSlice[]>
sliceProvider
-
Constructor Summary
Constructors Modifier Constructor Description private
CachingLeafSlicesSupplier(java.util.function.Function<java.util.List<LeafReaderContext>,IndexSearcher.LeafSlice[]> provider, java.util.List<LeafReaderContext> leaves)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IndexSearcher.LeafSlice[]
get()
-
-
-
Field Detail
-
leafSlices
private volatile IndexSearcher.LeafSlice[] leafSlices
-
sliceProvider
private final java.util.function.Function<java.util.List<LeafReaderContext>,IndexSearcher.LeafSlice[]> sliceProvider
-
leaves
private final java.util.List<LeafReaderContext> leaves
-
-
Constructor Detail
-
CachingLeafSlicesSupplier
private CachingLeafSlicesSupplier(java.util.function.Function<java.util.List<LeafReaderContext>,IndexSearcher.LeafSlice[]> provider, java.util.List<LeafReaderContext> leaves)
-
-
Method Detail
-
get
public IndexSearcher.LeafSlice[] get()
- Specified by:
get
in interfacejava.util.function.Supplier<IndexSearcher.LeafSlice[]>
-
-