Esempio n. 1
0
        private Task OpenServiceReplicaListeners()
        {
            var serviceReplicaListeners = _serviceInstance.InvokeCreateServiceReplicaListeners();

            OpenListeners = serviceReplicaListeners
                            .Where(rl => ReplicaRole == ReplicaRole.ActiveSecondary && rl.ListenOnSecondary ||
                                   ReplicaRole == ReplicaRole.Primary)
                            .Select(rl => rl.CreateCommunicationListener(_context))
                            .ToList();

            return(Task.WhenAll(OpenListeners.Select(l => l.OpenAsync(OpenCancellation.Token))));
        }
Esempio n. 2
0
 private Task CloseServiceReplicaListeners() => Task.WhenAll(OpenListeners.Select(l => l.CloseAsync(CloseCancellation.Token)));