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

Loading...
Searching...
No Matches
ConcurrentMergeScheduler.h
Go to the documentation of this file.
1
2// Copyright (c) 2009-2014 Alan Wright. All rights reserved.
3// Distributable under the terms of either the Apache License (Version 2.0)
4// or the GNU Lesser General Public License.
6
7#ifndef CONCURRENTMERGESCHEDULER_H
8#define CONCURRENTMERGESCHEDULER_H
9
10#include "MergeScheduler.h"
11
12 namespace Lucene {
13
19 class LPPAPI ConcurrentMergeScheduler : public MergeScheduler {
20 public:
21 ConcurrentMergeScheduler();
22 virtual ~ConcurrentMergeScheduler();
23
24 LUCENE_CLASS(ConcurrentMergeScheduler);
25
26 protected:
27 int32_t mergeThreadPriority;
28
29 SetMergeThread mergeThreads;
30
32 int32_t maxThreadCount;
33
34 DirectoryPtr dir;
35
36 bool closed;
37 IndexWriterWeakPtr _writer;
38
39 static Collection<ConcurrentMergeSchedulerPtr> allInstances;
40
41 bool suppressExceptions;
42 static bool anyExceptions;
43
44 public:
45 virtual void initialize();
46
50 virtual void setMaxThreadCount(int32_t count);
51
53 virtual int32_t getMaxThreadCount();
54
57 virtual int32_t getMergeThreadPriority();
58
60 virtual void setMergeThreadPriority(int32_t pri);
61
62 virtual void close();
63
64 virtual void sync();
65
66 virtual void merge(const IndexWriterPtr& writer);
67
69 static bool anyUnhandledExceptions();
70 static void clearUnhandledExceptions();
71
73 void setSuppressExceptions();
74 void clearSuppressExceptions();
75
77 static void setTestMode();
78
79 protected:
80 virtual bool verbose();
81 virtual void message(const String& message);
82 virtual void initMergeThreadPriority();
83 virtual int32_t mergeThreadCount();
84
86 virtual void doMerge(const OneMergePtr& merge);
87
88 virtual MergeThreadPtr getMergeThread(const IndexWriterPtr& writer, const OneMergePtr& merge);
89
91 virtual void handleMergeException(const LuceneException& exc);
92
93 virtual void addMyself();
94
95 friend class MergeThread;
96};
97
98}
99
100#endif
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition LuceneObject.h:24
MergeScheduler.h
Lucene::Collection
Utility template class to handle collections that can be safely copied and shared.
Definition Collection.h:17
Lucene::ConcurrentMergeScheduler::addMyself
virtual void addMyself()
Lucene::ConcurrentMergeScheduler::getMergeThreadPriority
virtual int32_t getMergeThreadPriority()
Return the priority that merge threads run at. By default the priority is 1 plus the priority of (ie,...
Lucene::ConcurrentMergeScheduler::clearSuppressExceptions
void clearSuppressExceptions()
Lucene::ConcurrentMergeScheduler::clearUnhandledExceptions
static void clearUnhandledExceptions()
Lucene::ConcurrentMergeScheduler::mergeThreadCount
virtual int32_t mergeThreadCount()
Lucene::ConcurrentMergeScheduler::message
virtual void message(const String &message)
Lucene::ConcurrentMergeScheduler::MergeThread
friend class MergeThread
Definition ConcurrentMergeScheduler.h:95
Lucene::ConcurrentMergeScheduler::merge
virtual void merge(const IndexWriterPtr &writer)
Run the merges provided by IndexWriter#getNextMerge().
Lucene::ConcurrentMergeScheduler::ConcurrentMergeScheduler
ConcurrentMergeScheduler()
Lucene::ConcurrentMergeScheduler::closed
bool closed
Definition ConcurrentMergeScheduler.h:36
Lucene::ConcurrentMergeScheduler::sync
virtual void sync()
Lucene::ConcurrentMergeScheduler::doMerge
virtual void doMerge(const OneMergePtr &merge)
Does the actual merge, by calling IndexWriter#merge.
Lucene::ConcurrentMergeScheduler::initialize
virtual void initialize()
Called directly after instantiation to create objects that depend on this object being fully construc...
Lucene::ConcurrentMergeScheduler::anyUnhandledExceptions
static bool anyUnhandledExceptions()
Used for testing.
Lucene::ConcurrentMergeScheduler::getMaxThreadCount
virtual int32_t getMaxThreadCount()
Get the max # simultaneous threads that may be running.
Lucene::ConcurrentMergeScheduler::initMergeThreadPriority
virtual void initMergeThreadPriority()
Lucene::ConcurrentMergeScheduler::setSuppressExceptions
void setSuppressExceptions()
Used for testing.
Lucene::ConcurrentMergeScheduler::suppressExceptions
bool suppressExceptions
Definition ConcurrentMergeScheduler.h:41
Lucene::ConcurrentMergeScheduler::allInstances
static Collection< ConcurrentMergeSchedulerPtr > allInstances
Definition ConcurrentMergeScheduler.h:39
Lucene::ConcurrentMergeScheduler::dir
DirectoryPtr dir
Definition ConcurrentMergeScheduler.h:34
Lucene::ConcurrentMergeScheduler::mergeThreadPriority
int32_t mergeThreadPriority
Definition ConcurrentMergeScheduler.h:27
Lucene::ConcurrentMergeScheduler::handleMergeException
virtual void handleMergeException(const LuceneException &exc)
Called when an exception is hit in a background merge thread.
Lucene::ConcurrentMergeScheduler::close
virtual void close()
Close this MergeScheduler.
Lucene::ConcurrentMergeScheduler::_writer
IndexWriterWeakPtr _writer
Definition ConcurrentMergeScheduler.h:37
Lucene::ConcurrentMergeScheduler::anyExceptions
static bool anyExceptions
Definition ConcurrentMergeScheduler.h:42
Lucene::ConcurrentMergeScheduler::verbose
virtual bool verbose()
Lucene::ConcurrentMergeScheduler::setMaxThreadCount
virtual void setMaxThreadCount(int32_t count)
Sets the max # simultaneous threads that may be running. If a merge is necessary yet we already have ...
Lucene::ConcurrentMergeScheduler::~ConcurrentMergeScheduler
virtual ~ConcurrentMergeScheduler()
Lucene::ConcurrentMergeScheduler::setTestMode
static void setTestMode()
Used for testing.
Lucene::ConcurrentMergeScheduler::maxThreadCount
int32_t maxThreadCount
Max number of threads allowed to be merging at once.
Definition ConcurrentMergeScheduler.h:32
Lucene::ConcurrentMergeScheduler::setMergeThreadPriority
virtual void setMergeThreadPriority(int32_t pri)
Set the priority that merge threads run at.
Lucene::ConcurrentMergeScheduler::getMergeThread
virtual MergeThreadPtr getMergeThread(const IndexWriterPtr &writer, const OneMergePtr &merge)
Lucene::ConcurrentMergeScheduler::mergeThreads
SetMergeThread mergeThreads
Definition ConcurrentMergeScheduler.h:29
Lucene::LuceneException
Lucene exception container.
Definition LuceneException.h:15
Lucene::MergeScheduler
IndexWriter uses an instance implementing this interface to execute the merges selected by a MergePol...
Definition MergeScheduler.h:16
Lucene
Definition AbstractAllTermDocs.h:12
Lucene::IndexWriterPtr
boost::shared_ptr< IndexWriter > IndexWriterPtr
Definition LuceneTypes.h:160
Lucene::MergeThreadPtr
boost::shared_ptr< MergeThread > MergeThreadPtr
Definition LuceneTypes.h:177
Lucene::IndexWriterWeakPtr
boost::weak_ptr< IndexWriter > IndexWriterWeakPtr
Definition LuceneTypes.h:160
Lucene::DirectoryPtr
boost::shared_ptr< Directory > DirectoryPtr
Definition LuceneTypes.h:489
Lucene::OneMergePtr
boost::shared_ptr< OneMerge > OneMergePtr
Definition LuceneTypes.h:192

clucene.sourceforge.net