Grpc.Core.GrpcEnvironment.ShutdownChannelsAsync C# (CSharp) Method

ShutdownChannelsAsync() public static method

Requests shutdown of all channels created by the current process.
public static ShutdownChannelsAsync ( ) : Task
return Task
        public static Task ShutdownChannelsAsync()
        {
            HashSet<Channel> snapshot = null;
            lock (staticLock)
            {
                snapshot = new HashSet<Channel>(registeredChannels);
            }
            return Task.WhenAll(snapshot.Select((channel) => channel.ShutdownAsync()));
        }

Usage Example

Beispiel #1
0
 /// <summary>
 /// Handler for AppDomain.DomainUnload, AppDomain.ProcessExit and AssemblyLoadContext.Unloading hooks.
 /// </summary>
 private static void HandleShutdown()
 {
     GrpcEnvironment.ShutdownChannelsAsync().Wait();
 }
All Usage Examples Of Grpc.Core.GrpcEnvironment::ShutdownChannelsAsync