Exemplo n.º 1
0
        private bool HeartBeatSilence(CancellationToken token)
        {
            const int rendezvousConfigurationChanged = 1;
            const int cancellationRequested          = 2;
            var       result = WaitHandle.WaitAny(new[]
            {
                heartBeatReceived,
                newRendezvousConfiguration,
                token.WaitHandle
            },
                                                  membershipConfiguration.HeartBeatSilenceBeforeRendezvousFailover);

            switch (result)
            {
            case WaitHandle.WaitTimeout:
                var rendezvousServer = rendezvousCluster.GetCurrentRendezvousServer();
                logger.Info($"HeartBeat timeout Rendezvous {rendezvousServer.BroadcastUri.AbsoluteUri}");
                rendezvousCluster.RotateRendezvousServers();
                return(true);

            case rendezvousConfigurationChanged:
                newRendezvousConfiguration.Reset();
                return(true);

            case cancellationRequested:
                return(false);
            }

            heartBeatReceived.Reset();
            return(false);
        }
Exemplo n.º 2
0
        private ISocket CreateClusterMonitorSendingSocket()
        {
            var rendezvousServer = rendezvousCluster.GetCurrentRendezvousServer();
            var socket           = socketFactory.CreateDealerSocket();

            socket.SendRate = performanceCounterManager.GetCounter(KinoPerformanceCounters.AutoDiscoverySenderSocketSendRate);
            socket.Connect(rendezvousServer.UnicastUri, true);

            return(socket);
        }