/// <summary> /// When the service is stopped, it deletes the data directory /// and its contents /// </summary> /// <exception cref="System.Exception"/> protected override void ServiceStop() { if (factory != null) { factory.Shutdown(); factory = null; } if (dataDir != null) { FileUtil.FullyDelete(dataDir); } }
internal static void ShutdownServerInstance(ServerCnxnFactory factory, string hostPort ) { if (factory != null) { ZKDatabase zkDb; { ZooKeeperServer zs = GetServer(factory); zkDb = zs.GetZKDatabase(); } factory.Shutdown(); try { zkDb.Close(); } catch (IOException ie) { Log.Warn("Error closing logs ", ie); } int Port = GetPort(hostPort); Assert.True("waiting for server down", ClientBaseWithFixes.WaitForServerDown ("127.0.0.1:" + Port, ConnectionTimeout)); } }