Class TaskMergeScheduler
A MergeScheduler that runs each merge using System.Threading.Tasks.Tasks on the default System.Threading.Tasks.TaskScheduler.
If more than MaxMergeCount merges are requested then this class will forcefully throttle the incoming threads by pausing until one more more merges complete.
LUCENENET specific
Inherited Members
Namespace: Lucene.Net.Index
Assembly: Lucene.Net.dll
Syntax
public class TaskMergeScheduler : MergeScheduler, IConcurrentMergeScheduler, IMergeScheduler, IDisposable
Constructors
| Improve this Doc View SourceTaskMergeScheduler()
Sole constructor, with all settings set to default values.
Declaration
public TaskMergeScheduler()
Fields
| Improve this Doc View SourceCOMPONENT_NAME
Declaration
public const string COMPONENT_NAME = "CMS"
Field Value
Type | Description |
---|---|
System.String |
Properties
| Improve this Doc View SourceMaxMergeCount
Max number of merges we accept before forcefully throttling the incoming threads
Declaration
public int MaxMergeCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
MaxThreadCount
Max number of merge threads allowed to be running at once. When there are more merges then this, we forcefully pause the larger ones, letting the smaller ones run, up until MaxMergeCount merges at which point we forcefully pause incoming threads (that presumably are the ones causing so much merging).
Declaration
public int MaxThreadCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
See Also
| Improve this Doc View SourceMergeThreadPriority
Return the priority that merge threads run at. This is always the same.
Declaration
public int MergeThreadPriority { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Verbose
Returns true
if verbosing is enabled. This method is usually used in
conjunction with Message(String), like that:
if (Verbose) {
Message("your message");
}
Declaration
protected bool Verbose { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceClearSuppressExceptions()
Used for testing
Declaration
public virtual void ClearSuppressExceptions()
Clone()
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
System.Object |
Overrides
| Improve this Doc View SourceDispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
| Improve this Doc View SourceDoMerge(MergePolicy.OneMerge)
Does the actual merge, by calling Merge(MergePolicy.OneMerge)
Declaration
protected virtual void DoMerge(MergePolicy.OneMerge merge)
Parameters
Type | Name | Description |
---|---|---|
MergePolicy.OneMerge | merge |
HandleMergeException(Exception)
Called when an exception is hit in a background merge thread
Declaration
protected virtual void HandleMergeException(Exception exc)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | exc |
Merge(IndexWriter, MergeTrigger, Boolean)
Declaration
public override void Merge(IndexWriter writer, MergeTrigger trigger, bool newMergesFound)
Parameters
Type | Name | Description |
---|---|---|
IndexWriter | writer | |
MergeTrigger | trigger | |
System.Boolean | newMergesFound |
Overrides
| Improve this Doc View SourceMessage(String)
Outputs the given message - this method assumes Verbose was
called and returned true
.
Declaration
protected virtual void Message(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message |
SetMaxMergesAndThreads(Int32, Int32)
Sets the maximum number of merge threads and simultaneous merges allowed.
Declaration
public void SetMaxMergesAndThreads(int maxMergeCount, int maxThreadCount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | maxMergeCount | The max # simultaneous merges that are allowed.
If a merge is necessary yet we already have this many
threads running, the incoming thread (that is calling
add/updateDocument) will block until a merge thread
has completed. Note that we will only run the
smallest |
System.Int32 | maxThreadCount | The max # simultaneous merge threads that should
be running at once. This must be <= |
SetMergeThreadPriority(Int32)
This method has no effect in TaskMergeScheduler because the MergeThreadPriority returns a constant value.
Declaration
public void SetMergeThreadPriority(int priority)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | priority |
SetSuppressExceptions()
Used for testing
Declaration
public virtual void SetSuppressExceptions()
Sync()
Wait for any running merge threads to finish. This call is not interruptible as used by Dispose().
Declaration
public virtual void Sync()
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |