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

    public abstract class MergeScheduler
    extends Object
    implements Closeable

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.

### Field Summary

Fields
`protected InfoStream` `infoStream` For messages about merge scheduling

### Constructor Summary

Constructors
`protected` `MergeScheduler()` Sole constructor.

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`abstract void` `close()` Close this MergeScheduler.
`abstract void` `merge(IndexWriter writer, MergeTrigger trigger, boolean newMergesFound)` Run the merges provided by `IndexWriter.getNextMerge()`.
`protected void` `message(String message)` Outputs the given message - this method assumes `verbose()` was called and returned true.
`protected boolean` `verbose()` Returns true if infoStream messages are enabled.
`Directory` `wrapForMerge(MergePolicy.OneMerge merge, Directory in)` Wraps the incoming `Directory` so that we can merge-throttle it using `RateLimitedIndexOutput`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### infoStream

    protected InfoStream infoStream

For messages about merge scheduling

### Constructor Detail

#### MergeScheduler

    protected MergeScheduler()

Sole constructor. (For invocation by subclass constructors, typically implicit.)

### Method Detail

#### merge

    public abstract void merge(IndexWriter writer,
                               MergeTrigger trigger,
                               boolean newMergesFound)
                        throws IOException

Run the merges provided by `IndexWriter.getNextMerge()`.

Parameters:
  `writer` - the `IndexWriter` to obtain the merges from.
  `trigger` - the `MergeTrigger` that caused this merge to happen
  `newMergesFound` - `true` iff any new merges were found by the caller otherwise `false`
Throws:
  `IOException`

#### wrapForMerge

    public Directory wrapForMerge(MergePolicy.OneMerge merge,
                                  Directory in)

Wraps the incoming `Directory` so that we can merge-throttle it using `RateLimitedIndexOutput`.

#### close

    public abstract void close()
                        throws IOException

Close this MergeScheduler.

Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `AutoCloseable`
Throws:
  `IOException`

#### verbose

    protected boolean verbose()

Returns true if infoStream messages are enabled. This method is usually used in conjunction with `message(String)`:

     if (verbose()) {
       message("your message");
     }

#### message

    protected void message(String message)

Outputs the given message - this method assumes `verbose()` was called and returned true.