public bool Shutdown(DocumentIndexShutdownSetup setup) { if (!_isAlive) { return(true); } if (ShouldShutdown(setup)) { Log("[Shutdown] started"); DoOptimize(true); try { _hoot.FreeMemory(false); _hoot.Shutdown(); if (setup.CleanStorage) { string[] files = Directory.GetFiles(_hoot.Path, _hoot.FileName + ".*", SearchOption.AllDirectories); foreach (var file in files) { File.Delete(file); } } _shuttedDown(); Log("[Shutdown] finished successfull"); return(true); } finally { _isAlive = false; } } return(false); }
public bool Shutdown(DocumentIndexShutdownSetup setup) { lock (_gate) { if (!_isAlive) { return(true); } if (setup.ForceShutdown || _lastUsedTime.AddMinutes(_documentIndexSetup.AliveTimeoutInMinutes) < DateTime.UtcNow) { try { _shuttingDown(); _hoot.FreeMemory(false); _hoot.Shutdown(); if (setup.CleanStorage) { string[] files = Directory.GetFiles(_hoot.Path, _hoot.FileName + ".*", SearchOption.AllDirectories); foreach (var file in files) { File.Delete(file); } } return(true); } finally { _isAlive = false; } } } return(false); }
/// <summary> /// Free Memory /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { if (hoot == null) { loadhoot(); } else { return; } // free memory hoot.FreeMemory(); GC.Collect(GC.MaxGeneration); }