public static Task ShutdownChannelsAsync() { HashSet<Channel> snapshot = null; lock (staticLock) { snapshot = new HashSet<Channel>(registeredChannels); } return Task.WhenAll(snapshot.Select((channel) => channel.ShutdownAsync())); }
/// <summary> /// Handler for AppDomain.DomainUnload, AppDomain.ProcessExit and AssemblyLoadContext.Unloading hooks. /// </summary> private static void HandleShutdown() { GrpcEnvironment.ShutdownChannelsAsync().Wait(); }