Ejemplo n.º 1
0
        public virtual void Reload()
        {
            Log.Info(m => m("Reloading index."));

            lock (reloadLock)
            {
                var newTracker = new SearcherClientTracker(CreateSearcher());

                var tmpHandler = SearcherLoading;

                if (tmpHandler != null)
                {
                    Log.Debug(m => m("Invoking SearcherLoading event."));
                    tmpHandler(this, new SearcherLoadEventArgs(newTracker.Searcher));
                }

                lock (searcherLock)
                {
                    if (tracker != null)
                    {
                        tracker.Dispose();
                    }

                    tracker = newTracker;
                }
            }

            Log.Debug(m => m("Index reloading completed."));
        }
Ejemplo n.º 2
0
        public virtual void Reload()
        {
            Log.Info(m => m("Reloading index."));

            lock (reloadLock)
            {
                var newTracker = new SearcherClientTracker(CreateSearcher());

                var tmpHandler = SearcherLoading;

                if (tmpHandler != null)
                {
                    Log.Debug(m => m("Invoking SearcherLoading event."));
                    tmpHandler(this, new SearcherLoadEventArgs(newTracker.Searcher));
                }

                lock (searcherLock)
                {
                    if (tracker != null)
                    {
                        tracker.Dispose();
                    }

                    tracker = newTracker;
                }
            }

            Log.Debug(m => m("Index reloading completed."));
        }
Ejemplo n.º 3
0
        public void Dispose()
        {
            lock (searcherLock)
            {
                AssertNotDisposed();

                disposed = true;

                if (tracker == null) return;

                if (!tracker.TryDispose())
                {
                    Log.Warn(m => m("Context is being disposed before all handles were released."));
                }

                tracker = null;
            }
        }
Ejemplo n.º 4
0
        public virtual void Reload()
        {
            lock (reloadLock)
            {
                AssertNotDisposed();
                Log.Info(() => ("Reloading index."));

                IndexSearcher searcher;
                if (reader == null)
                {
                    searcher = CreateSearcher();
                    reader   = searcher.IndexReader;
                }
                else if (!ReopenSearcher(out searcher))
                {
                    return;
                }

                var newTracker = new SearcherClientTracker(searcher);

                var tmpHandler = SearcherLoading;

                if (tmpHandler != null)
                {
                    Log.Debug(() => ("Invoking SearcherLoading event."));
                    tmpHandler(this, new SearcherLoadEventArgs(newTracker.Searcher));
                }

                lock (searcherLock)
                {
                    if (tracker != null)
                    {
                        tracker.Dispose();
                    }

                    tracker = newTracker;
                }
            }

            Log.Debug(() => ("Index reloading completed."));
        }
Ejemplo n.º 5
0
        public void Dispose()
        {
            lock (searcherLock)
            {
                AssertNotDisposed();

                disposed = true;

                if (tracker == null)
                {
                    return;
                }

                if (!tracker.TryDispose())
                {
                    Log.Warn(() => ("Context is being disposed before all handles were released."));
                }

                tracker = null;
            }
        }
Ejemplo n.º 6
0
        public virtual void Reload()
        {
            lock (reloadLock)
            {
                var newTracker = new SearcherClientTracker(CreateSearcher());

                var tmpHandler = SearcherLoading;

                if (tmpHandler != null)
                {
                    tmpHandler(this, new SearcherLoadEventArgs(newTracker.Searcher));
                }

                lock (searcherLock)
                {
                    if (tracker != null)
                    {
                        tracker.Dispose();
                    }

                    tracker = newTracker;
                }
            }
        }
Ejemplo n.º 7
0
 public SearcherHandle(SearcherClientTracker tracker)
 {
     this.tracker = tracker;
     tracker.AddClient(this);
 }
Ejemplo n.º 8
0
 public SearcherHandle(SearcherClientTracker tracker)
 {
     this.tracker = tracker;
     tracker.AddClient(this);
 }
Ejemplo n.º 9
0
        public virtual void Reload()
        {
            lock (reloadLock)
            {
                AssertNotDisposed();
                Log.Info(m => m("Reloading index."));

                IndexSearcher searcher;
                if (reader == null)
                {
                    searcher = CreateSearcher();
                    reader = searcher.IndexReader;
                }
                else if (!ReopenSearcher(out searcher))
                {
                    return;
                }

                var newTracker = new SearcherClientTracker(searcher);

                var tmpHandler = SearcherLoading;

                if (tmpHandler != null)
                {
                    Log.Debug(m => m("Invoking SearcherLoading event."));
                    tmpHandler(this, new SearcherLoadEventArgs(newTracker.Searcher));
                }

                lock (searcherLock)
                {
                    if (tracker != null)
                    {
                        tracker.Dispose();
                    }

                    tracker = newTracker;
                }
            }

            Log.Debug(m => m("Index reloading completed."));
        }