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

ConcurrentMergeScheduler.h
Go to the documentation of this file.
1 // 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::ConcurrentMergeScheduler
A MergeScheduler that runs each merge using a separate thread, up until a maximum number of threads (...
Definition: ConcurrentMergeScheduler.h:19
Lucene::ConcurrentMergeScheduler::dir
DirectoryPtr dir
Definition: ConcurrentMergeScheduler.h:34
Lucene::ConcurrentMergeScheduler::_writer
IndexWriterWeakPtr _writer
Definition: ConcurrentMergeScheduler.h:37
LUCENE_CLASS
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Lucene::MergeThreadPtr
boost::shared_ptr< MergeThread > MergeThreadPtr
Definition: LuceneTypes.h:177
Lucene::Collection< ConcurrentMergeSchedulerPtr >
Lucene::MergeScheduler
IndexWriter uses an instance implementing this interface to execute the merges selected by a MergePol...
Definition: MergeScheduler.h:16
Lucene::OneMergePtr
boost::shared_ptr< OneMerge > OneMergePtr
Definition: LuceneTypes.h:192
Lucene::ConcurrentMergeScheduler::closed
bool closed
Definition: ConcurrentMergeScheduler.h:36
Lucene::IndexWriterWeakPtr
boost::weak_ptr< IndexWriter > IndexWriterWeakPtr
Definition: LuceneTypes.h:160
Lucene
Definition: AbstractAllTermDocs.h:12
Lucene::ConcurrentMergeScheduler::maxThreadCount
int32_t maxThreadCount
Max number of threads allowed to be merging at once.
Definition: ConcurrentMergeScheduler.h:32
MergeScheduler.h
Lucene::ConcurrentMergeScheduler::allInstances
static Collection< ConcurrentMergeSchedulerPtr > allInstances
Definition: ConcurrentMergeScheduler.h:39
Lucene::LuceneException
Lucene exception container.
Definition: LuceneException.h:15
Lucene::ConcurrentMergeScheduler::mergeThreads
SetMergeThread mergeThreads
Definition: ConcurrentMergeScheduler.h:29
Lucene::DirectoryPtr
boost::shared_ptr< Directory > DirectoryPtr
Definition: LuceneTypes.h:489
Lucene::ConcurrentMergeScheduler::suppressExceptions
bool suppressExceptions
Definition: ConcurrentMergeScheduler.h:41
Lucene::ConcurrentMergeScheduler::anyExceptions
static bool anyExceptions
Definition: ConcurrentMergeScheduler.h:42
Lucene::IndexWriterPtr
boost::shared_ptr< IndexWriter > IndexWriterPtr
Definition: LuceneTypes.h:160

clucene.sourceforge.net