示例#1
0
        private static void ShutDown(bool log)
        {
            if (!_running)
            {
                return;
            }
            if (Paused)
            {
                throw GetPausedException();
            }

            using (var op = SnTrace.Index.StartOperation("LUCENEMANAGER SHUTDOWN"))
            {
                if (_writer != null)
                {
                    _stopCommitWorker = true;

                    lock (_commitLock)
                        Commit(false);

                    using (var op2 = SnTrace.Index.StartOperation("LM.CloseReaders"))
                    {
                        using (var wrFrame = IndexWriterFrame.Get(true)) // // ShutDown
                        {
                            if (_reader != null)
                            {
                                _reader.Close();
                            }
                            if (_writer != null)
                            {
                                _writer.Close();
                            }
                            _running = false;
                        }
                        op2.Successful = true;
                    }
                    op.Successful = true;
                }
            }


            if (log)
            {
                SnLog.WriteInformation("LuceneManager has stopped. Max task id and exceptions: " + IndexingActivityQueue.GetCurrentCompletionState());
            }
        }
示例#2
0
 internal static CompletionState GetCurrent()
 {
     return(IndexingActivityQueue.GetCurrentCompletionState());
 }