Lucene++ - a full-featured, c++ search engine
API Documentation

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
Lucene::ConcurrentMergeScheduler Class Reference

A `MergeScheduler` that runs each merge using a separate thread, up until a maximum number of threads (`setMaxThreadCount`) at which when a merge is needed, the thread(s) that are updating the index will pause until one or more merges completes. This is a simple way to use concurrency in the indexing process without having to create and manage application level threads. More...

`#include <ConcurrentMergeScheduler.h>`

Inheritance diagram for Lucene::ConcurrentMergeScheduler:

## Public Member Functions

| ConcurrentMergeScheduler ()
virtual | ~ConcurrentMergeScheduler ()
virtual String | getClassName ()
boost::shared_ptr< ConcurrentMergeScheduler > | shared_from_this ()
virtual void | initialize ()
| Called directly after instantiation to create objects that depend on this object being fully constructed.
virtual void | setMaxThreadCount (int32_t count)
| Sets the max # simultaneous threads that may be running. 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.
virtual int32_t | getMaxThreadCount ()
| Get the max # simultaneous threads that may be running.
virtual int32_t | getMergeThreadPriority ()
| Return the priority that merge threads run at. By default the priority is 1 plus the priority of (ie, slightly higher priority than) the first thread that calls merge.
virtual void | setMergeThreadPriority (int32_t pri)
| Set the priority that merge threads run at.
virtual void | close ()
| Close this MergeScheduler.
virtual void | sync ()
virtual void | merge (const IndexWriterPtr &writer)
| Run the merges provided by `IndexWriter#getNextMerge()`.
void | setSuppressExceptions ()
| Used for testing.
void | clearSuppressExceptions ()
Public Member Functions inherited from Lucene::MergeScheduler
virtual | ~MergeScheduler ()
boost::shared_ptr< MergeScheduler > | shared_from_this ()
Public Member Functions inherited from Lucene::LuceneObject
virtual | ~LuceneObject ()
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr())
| Return clone of this object.
virtual int32_t | hashCode ()
| Return hash code for this object.
virtual bool | equals (const LuceneObjectPtr &other)
| Return whether two objects are equal.
virtual int32_t | compareTo (const LuceneObjectPtr &other)
| Compare two objects.
virtual String | toString ()
| Returns a string representation of the object.
Public Member Functions inherited from Lucene::LuceneSync
virtual | ~LuceneSync ()
virtual SynchronizePtr | getSync ()
| Return this object synchronize lock.
virtual LuceneSignalPtr | getSignal ()
| Return this object signal.
virtual void | lock (int32_t timeout=0)
| Lock this object using an optional timeout.
virtual void | unlock ()
| Unlock this object.
virtual bool | holdsLock ()
| Returns true if this object is currently locked by current thread.
virtual void | wait (int32_t timeout=0)
| Wait for signal using an optional timeout.
virtual void | notifyAll ()
| Notify all threads waiting for signal.

## Static Public Member Functions

static String | _getClassName ()
static bool | anyUnhandledExceptions ()
| Used for testing.
static void | clearUnhandledExceptions ()
static void | setTestMode ()
| Used for testing.
Static Public Member Functions inherited from Lucene::MergeScheduler
static String | _getClassName ()

## Protected Member Functions

virtual bool | verbose ()
virtual void | message (const String &message)
virtual void | initMergeThreadPriority ()
virtual int32_t | mergeThreadCount ()
virtual void | doMerge (const OneMergePtr &merge)
| Does the actual merge, by calling `IndexWriter#merge`.
virtual MergeThreadPtr | getMergeThread (const IndexWriterPtr &writer, const OneMergePtr &merge)
virtual void | handleMergeException (const LuceneException &exc)
| Called when an exception is hit in a background merge thread.
virtual void | addMyself ()
Protected Member Functions inherited from Lucene::LuceneObject
| LuceneObject ()

## Protected Attributes

int32_t | mergeThreadPriority
SetMergeThread | mergeThreads
int32_t | maxThreadCount
| Max number of threads allowed to be merging at once.
DirectoryPtr | dir
bool | closed
IndexWriterWeakPtr | _writer
bool | suppressExceptions
Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr | objectLock
LuceneSignalPtr | objectSignal

## Static Protected Attributes

static Collection< ConcurrentMergeSchedulerPtr > | allInstances
static bool | anyExceptions

## Detailed Description

A `MergeScheduler` that runs each merge using a separate thread, up until a maximum number of threads (`setMaxThreadCount`) at which when a merge is needed, the thread(s) that are updating the index will pause until one or more merges completes. This is a simple way to use concurrency in the indexing process without having to create and manage application level threads.

## Constructor & Destructor Documentation

## ◆ ConcurrentMergeScheduler()

Lucene::ConcurrentMergeScheduler::ConcurrentMergeScheduler | ( |  | ) |

Referenced by _getClassName().

## ◆ ~ConcurrentMergeScheduler()

virtual Lucene::ConcurrentMergeScheduler::~ConcurrentMergeScheduler | ( |  | ) |

virtual

## Member Function Documentation

## ◆ _getClassName()

String Lucene::ConcurrentMergeScheduler::_getClassName | ( |  | ) |

inline static

References ConcurrentMergeScheduler().

## ◆ addMyself()

virtual void Lucene::ConcurrentMergeScheduler::addMyself | ( |  | ) |

protected virtual

## ◆ anyUnhandledExceptions()

bool Lucene::ConcurrentMergeScheduler::anyUnhandledExceptions | ( |  | ) |

static

Used for testing.

## ◆ clearSuppressExceptions()

void Lucene::ConcurrentMergeScheduler::clearSuppressExceptions | ( |  | ) |

## ◆ clearUnhandledExceptions()

void Lucene::ConcurrentMergeScheduler::clearUnhandledExceptions | ( |  | ) |

static

## ◆ close()

virtual void Lucene::ConcurrentMergeScheduler::close | ( |  | ) |

virtual

Close this MergeScheduler.

Implements Lucene::MergeScheduler.

## ◆ doMerge()

virtual void Lucene::ConcurrentMergeScheduler::doMerge | ( | const OneMergePtr & | merge | ) |

protected virtual

Does the actual merge, by calling `IndexWriter#merge`.

References merge().

## ◆ getClassName()

virtual String Lucene::ConcurrentMergeScheduler::getClassName | ( |  | ) |

inline virtual

Reimplemented from Lucene::MergeScheduler.

## ◆ getMaxThreadCount()

virtual int32_t Lucene::ConcurrentMergeScheduler::getMaxThreadCount | ( |  | ) |

virtual

Get the max # simultaneous threads that may be running.

See also
  setMaxThreadCount.

## ◆ getMergeThread()

virtual MergeThreadPtr Lucene::ConcurrentMergeScheduler::getMergeThread | ( | const IndexWriterPtr & | writer,
|  | const OneMergePtr & | merge )

protected virtual

References merge().

## ◆ getMergeThreadPriority()

virtual int32_t Lucene::ConcurrentMergeScheduler::getMergeThreadPriority | ( |  | ) |

virtual

Return the priority that merge threads run at. By default the priority is 1 plus the priority of (ie, slightly higher priority than) the first thread that calls merge.

## ◆ handleMergeException()

virtual void Lucene::ConcurrentMergeScheduler::handleMergeException | ( | const LuceneException & | exc | ) |

protected virtual

Called when an exception is hit in a background merge thread.

## ◆ initialize()

virtual void Lucene::ConcurrentMergeScheduler::initialize | ( |  | ) |

virtual

Called directly after instantiation to create objects that depend on this object being fully constructed.

Reimplemented from Lucene::LuceneObject.

## ◆ initMergeThreadPriority()

virtual void Lucene::ConcurrentMergeScheduler::initMergeThreadPriority | ( |  | ) |

protected virtual

## ◆ merge()

virtual void Lucene::ConcurrentMergeScheduler::merge | ( | const IndexWriterPtr & | writer | ) |

virtual

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

Implements Lucene::MergeScheduler.

Referenced by doMerge(), and getMergeThread().

## ◆ mergeThreadCount()

virtual int32_t Lucene::ConcurrentMergeScheduler::mergeThreadCount | ( |  | ) |

protected virtual

## ◆ message()

virtual void Lucene::ConcurrentMergeScheduler::message | ( | const String & | message | ) |

protected virtual

References message().

Referenced by message().

## ◆ setMaxThreadCount()

virtual void Lucene::ConcurrentMergeScheduler::setMaxThreadCount | ( | int32_t | count | ) |

virtual

Sets the max # simultaneous threads that may be running. 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.

## ◆ setMergeThreadPriority()

virtual void Lucene::ConcurrentMergeScheduler::setMergeThreadPriority | ( | int32_t | pri | ) |

virtual

Set the priority that merge threads run at.

## ◆ setSuppressExceptions()

void Lucene::ConcurrentMergeScheduler::setSuppressExceptions | ( |  | ) |

Used for testing.

## ◆ setTestMode()

void Lucene::ConcurrentMergeScheduler::setTestMode | ( |  | ) |

static

Used for testing.

## ◆ shared_from_this()

boost::shared_ptr< ConcurrentMergeScheduler > Lucene::ConcurrentMergeScheduler::shared_from_this | ( |  | ) |

inline

## ◆ sync()

virtual void Lucene::ConcurrentMergeScheduler::sync | ( |  | ) |

virtual

## ◆ verbose()

virtual bool Lucene::ConcurrentMergeScheduler::verbose | ( |  | ) |

protected virtual

## Field Documentation

## ◆ _writer

IndexWriterWeakPtr Lucene::ConcurrentMergeScheduler::_writer

protected

## ◆ allInstances

Collection<ConcurrentMergeSchedulerPtr> Lucene::ConcurrentMergeScheduler::allInstances

static protected

## ◆ anyExceptions

bool Lucene::ConcurrentMergeScheduler::anyExceptions

static protected

## ◆ closed

bool Lucene::ConcurrentMergeScheduler::closed

protected

## ◆ dir

DirectoryPtr Lucene::ConcurrentMergeScheduler::dir

protected

## ◆ maxThreadCount

int32_t Lucene::ConcurrentMergeScheduler::maxThreadCount

protected

Max number of threads allowed to be merging at once.

## ◆ mergeThreadPriority

int32_t Lucene::ConcurrentMergeScheduler::mergeThreadPriority

protected

## ◆ mergeThreads

SetMergeThread Lucene::ConcurrentMergeScheduler::mergeThreads

protected

## ◆ suppressExceptions

bool Lucene::ConcurrentMergeScheduler::suppressExceptions

protected

The documentation for this class was generated from the following file:

- ConcurrentMergeScheduler.h

clucene.sourceforge.net