public static void Test(string host, int port, string localHost, int?localPort) { System.Console.ReadLine(); //var serviceProxyManager = Init(host, port, localHost, localPort); var serviceProxyManager = InitWithConfig(host, port, localHost, localPort); //var serviceProxyManager = InitWithZookeeper(host, port, localHost, localPort); System.Console.ReadLine(); var beginTime = DateTime.Now; for (var i = 0; i < 1; i++) { CallGetServiceName(); CallAddCustomer().Wait(); CallGetCustomer(); CallQueryCustomer().Wait(); CallRemoveCustomer(); CallQueryCustomer().Wait(); CallRemoveAllCustomer(); CallQueryCustomer().Wait(); } CallAddOrder().Wait(); CallQueryOrder().Wait(); var endTime = DateTime.Now; System.Console.WriteLine($"Start time: {beginTime.ToString("yyyy-MM-dd HH:mm:ss")}"); System.Console.WriteLine($"End time: {endTime.ToString("yyyy-MM-dd HH:mm:ss")} Used time: {endTime - beginTime}"); System.Console.ReadLine(); if (serviceSubscriber != null) { serviceSubscriber.Dispose(); } serviceProxyManager.CloseAsync().ContinueWith(task => { if (task.Exception != null) { System.Console.WriteLine(task.Exception.InnerException.Message); return; } System.Console.WriteLine("Closed"); }).ContinueWith(task => BootstrapManager.Disable()); }
protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { _throttleActions.Dispose(); _throttlePeriods.Dispose(); _serviceSubscriber.Dispose(); } _disposed = true; }
protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { if (!_cts.IsCancellationRequested) { _cts.Cancel(); } _cts.Dispose(); _mutex.Dispose(); _serviceSubscriber.Dispose(); } _cache.Remove(_id); _disposed = true; }