public void Shutdown(bool keepDb = false, bool keepPorts = false) { StoppingTime.Start(); var shutdownEvent = new ManualResetEventSlim(false); Node.MainBus.Subscribe(new AdHocHandler <SystemMessage.BecomeShutdown>(m => shutdownEvent.Set())); Node.Stop(exitProcess: true); if (!shutdownEvent.Wait(20000)) { throw new TimeoutException("MiniNode haven't shut down in 20 seconds."); } if (!keepPorts) { PortsHelper.ReturnPort(TcpEndPoint.Port); PortsHelper.ReturnPort(TcpSecEndPoint.Port); PortsHelper.ReturnPort(HttpEndPoint.Port); } if (!keepDb) { TryDeleteDirectory(_dbPath); } StoppingTime.Stop(); RunningTime.Stop(); _running = false; }
public void Shutdown() { _node.Stop(); Thread.Sleep(2000); _chaserChk.Dispose(); _writerChk.Dispose(); _tfChunkDb.Dispose(); TryDeleteDirectory(_oneTimeDbPath); }
public void Stop() { if (_connection != null) { _connection.Close(); } if (_node != null) { _node.Stop(false); } }
protected virtual void TearDown() { try { var shutdownCallback = new EnvelopeCallback <SystemMessage.BecomeShutdown>(); _vNode.Bus.Subscribe <SystemMessage.BecomeShutdown>(shutdownCallback); _vNode.Stop(); shutdownCallback.Wait(); _db.Dispose(); _writerChk.Dispose(); _chaserChk.Dispose(); Directory.Delete(_db.Config.Path, true); _vNode = null; _db = null; } catch (Exception) { } }
public override void Stop() { _node.Stop(); }
public override void Stop() { _node.Stop(exitProcess: true); }