public static void ShutdownDocumentIndexes(this IDocumentIndexProvider documentIndexProvider, IPluginContext context, DocumentIndexShutdownSetup setup, IActivityLogger logger) { foreach (IDocumentIndex documentIndex in GetDocumentIndexes(documentIndexProvider, context, runningOnly:false)) { var success = documentIndex.Shutdown(setup); logger.DebugFormat("{0} was {1} shutted down", documentIndex.Type.TypeToken, success ? string.Empty : "not"); } }
public void Stop() { _log.Debug("Save and free Hoot storages memory at stopping Search Plugin"); var accountCollection = ObjectFactory.GetInstance <IAccountCollection>(); if (accountCollection != null && accountCollection.Any()) { accountCollection.Where(x => x.Profiles.Any()) .AsParallel() .ForEach(a => { _log.DebugFormat("Shutting down indexes for {0} during stopping service", a.Name); _documentIndexProvider.ShutdownDocumentIndexesIfRunning(new PluginContextSnapshot(a.Name, a.Profiles.First().Name, _pluginContext.PluginName), new DocumentIndexShutdownSetup(forceShutdown: true, cleanStorage: false), _log); _log.DebugFormat("Indexes shutted down for {0} during stopping service", a.Name); }); } _log.Debug("Finished to save and free Hoot storages memory at stopping Search Plugin"); }
public static void ShutdownDocumentIndexesIfRunning(this IDocumentIndexProvider documentIndexProvider, IPluginContext context, DocumentIndexShutdownSetup setup, IActivityLogger logger) { foreach (IDocumentIndex documentIndex in GetDocumentIndexes(documentIndexProvider, context, runningOnly:true)) { if (documentIndex.Shutdown(setup)) { logger.DebugFormat("{0} was shutted down", documentIndex.Type.TypeToken); } } }
private void Log(string message) { _logger.DebugFormat("[{0}]{1}", _indexType, message); }
public void DetachIndex() { _logger.DebugFormat("[shutdown {0}] index was detached", _documentIndexType.TypeToken); _documentIndex = null; }