From ae607078fcd00d7b11eacca4ea1937b428547304 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch <jtattermusch@google.com> Date: Tue, 8 Aug 2017 10:58:15 +0200 Subject: [PATCH] address comments --- src/csharp/Grpc.Core/GrpcEnvironment.cs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/csharp/Grpc.Core/GrpcEnvironment.cs b/src/csharp/Grpc.Core/GrpcEnvironment.cs index a466c9fa37..9fad5c6a54 100644 --- a/src/csharp/Grpc.Core/GrpcEnvironment.cs +++ b/src/csharp/Grpc.Core/GrpcEnvironment.cs @@ -43,8 +43,6 @@ namespace Grpc.Core static readonly HashSet<Channel> registeredChannels = new HashSet<Channel>(); static readonly HashSet<Server> registeredServers = new HashSet<Server>(); - static EventHandler shuttingDown; - static ILogger logger = new NullLogger(); readonly GrpcThreadPool threadPool; @@ -242,17 +240,7 @@ namespace Grpc.Core /// <summary> /// Occurs when <c>GrpcEnvironment</c> is about the start the shutdown logic. /// </summary> - public static event EventHandler ShuttingDown - { - add - { - shuttingDown += value; - } - remove - { - shuttingDown -= value; - } - } + public static event EventHandler ShuttingDown; /// <summary> /// Creates gRPC environment. @@ -333,7 +321,7 @@ namespace Grpc.Core throw new InvalidOperationException("ShutdownAsync has already been called"); } - await Task.Run(() => shuttingDown.Invoke(this, null)); + await Task.Run(() => ShuttingDown?.Invoke(this, null)); await threadPool.StopAsync().ConfigureAwait(false); GrpcNativeShutdown(); -- GitLab