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< ConcurrentMergeSchedulershared_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< MergeSchedulershared_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< ConcurrentMergeSchedulerPtrallInstances
 
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 ( )

◆ ~ConcurrentMergeScheduler()

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

Member Function Documentation

◆ _getClassName()

static String Lucene::ConcurrentMergeScheduler::_getClassName ( )
inlinestatic

◆ addMyself()

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

◆ anyUnhandledExceptions()

static bool Lucene::ConcurrentMergeScheduler::anyUnhandledExceptions ( )
static

Used for testing.

◆ clearSuppressExceptions()

void Lucene::ConcurrentMergeScheduler::clearSuppressExceptions ( )

◆ clearUnhandledExceptions()

static 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)
protectedvirtual

Does the actual merge, by calling IndexWriter#merge.

◆ getClassName()

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

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 
)
protectedvirtual

◆ 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)
protectedvirtual

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 ( )
protectedvirtual

◆ merge()

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

Run the merges provided by IndexWriter#getNextMerge().

Implements Lucene::MergeScheduler.

◆ mergeThreadCount()

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

◆ message()

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

◆ 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()

static 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 ( )
protectedvirtual

Field Documentation

◆ _writer

IndexWriterWeakPtr Lucene::ConcurrentMergeScheduler::_writer
protected

◆ allInstances

Collection<ConcurrentMergeSchedulerPtr> Lucene::ConcurrentMergeScheduler::allInstances
staticprotected

◆ anyExceptions

bool Lucene::ConcurrentMergeScheduler::anyExceptions
staticprotected

◆ 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:

clucene.sourceforge.net