Package org.apache.lucene.index
Class MergeScheduler
java.lang.Object
org.apache.lucene.index.MergeScheduler
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
ConcurrentMergeScheduler,NoMergeScheduler,SerialMergeScheduler
Expert:
IndexWriter uses an instance implementing this interface to execute the merges
selected by a MergePolicy. The default MergeScheduler is ConcurrentMergeScheduler.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceProvides access to new merges and executes the actual merge -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this MergeScheduler.Provides an executor for parallelism during a single merge operation.abstract voidmerge(MergeScheduler.MergeSource mergeSource, MergeTrigger trigger) Run the merges provided byMergeScheduler.MergeSource.getNextMerge().protected voidOutputs the given message - this method assumesverbose()was called and returned true.protected booleanverbose()Returns true if infoStream messages are enabled.wrapForMerge(MergePolicy.OneMerge merge, Directory in) Wraps the incomingDirectoryso that we can merge-throttle it usingRateLimitedIndexOutput.
-
Field Details
-
infoStream
For messages about merge scheduling
-
-
Constructor Details
-
MergeScheduler
protected MergeScheduler()Sole constructor. (For invocation by subclass constructors, typically implicit.)
-
-
Method Details
-
merge
public abstract void merge(MergeScheduler.MergeSource mergeSource, MergeTrigger trigger) throws IOException Run the merges provided byMergeScheduler.MergeSource.getNextMerge().- Parameters:
mergeSource- theIndexWriterto obtain the merges from.trigger- theMergeTriggerthat caused this merge to happen- Throws:
IOException
-
wrapForMerge
Wraps the incomingDirectoryso that we can merge-throttle it usingRateLimitedIndexOutput. -
getIntraMergeExecutor
Provides an executor for parallelism during a single merge operation. By default, the method returns aSameThreadExecutorServicewhere all intra-merge actions occur in their calling thread. -
close
Close this MergeScheduler.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
verbose
protected boolean verbose()Returns true if infoStream messages are enabled. This method is usually used in conjunction withmessage(String):if (verbose()) { message("your message"); } -
message
Outputs the given message - this method assumesverbose()was called and returned true.
-