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.")); }
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; } }
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.")); }
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; } }
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; } } }
public SearcherHandle(SearcherClientTracker tracker) { this.tracker = tracker; tracker.AddClient(this); }
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.")); }