Example #1
0
        public MultiClusterOracle(
            ILocalSiloDetails siloDetails,
            MultiClusterGossipChannelFactory channelFactory,
            ISiloStatusOracle siloStatusOracle,
            MembershipTableManager tableManager,
            IInternalGrainFactory grainFactory,
            ILoggerFactory loggerFactory,
            IOptions <MultiClusterOptions> multiClusterOptions)
            : base(Constants.MultiClusterOracleId, siloDetails.SiloAddress, loggerFactory)
        {
            this.loggerFactory    = loggerFactory;
            this.channelFactory   = channelFactory;
            this.siloStatusOracle = siloStatusOracle;
            this.tableManager     = tableManager;
            this.grainFactory     = grainFactory;

            logger    = loggerFactory.CreateLogger <MultiClusterOracle>();
            localData = new MultiClusterOracleData(logger, grainFactory);
            clusterId = siloDetails.ClusterId;
            var multiClusterOptionsSnapshot = multiClusterOptions.Value;

            defaultMultiCluster          = multiClusterOptionsSnapshot.DefaultMultiCluster?.ToList();
            this.multiClusterActive      = multiClusterOptionsSnapshot.HasMultiClusterNetwork;
            this.maxMultiClusterGateways = multiClusterOptionsSnapshot.MaxMultiClusterGateways;
            random = new SafeRandom();

            // to avoid convoying, each silo varies these period intervals a little
            backgroundGossipInterval = RandomizeTimespanSlightly(multiClusterOptionsSnapshot.BackgroundGossipInterval);
            resendActiveStatusAfter  = RandomizeTimespanSlightly(ResendActiveStatusAfter);
        }
Example #2
0
        public MultiClusterOracle(SiloInitializationParameters siloDetails, MultiClusterGossipChannelFactory channelFactory, ISiloStatusOracle siloStatusOracle, IInternalGrainFactory grainFactory)
            : base(Constants.MultiClusterOracleId, siloDetails.SiloAddress)
        {
            this.channelFactory = channelFactory;
            this.siloStatusOracle = siloStatusOracle;
            this.grainFactory = grainFactory;
            if (siloDetails == null) throw new ArgumentNullException(nameof(siloDetails));

            var config = siloDetails.GlobalConfig;
            logger = LogManager.GetLogger("MultiClusterOracle");
            localData = new MultiClusterOracleData(logger, grainFactory);
            clusterId = config.ClusterId;
            defaultMultiCluster = config.DefaultMultiCluster;
            random = new SafeRandom();

            // to avoid convoying, each silo varies these period intervals a little
            backgroundGossipInterval = RandomizeTimespanSlightly(config.BackgroundGossipInterval);
            resendActiveStatusAfter = RandomizeTimespanSlightly(ResendActiveStatusAfter);
        }
Example #3
0
        public MultiClusterOracle(SiloAddress silo, List <IGossipChannel> sources, GlobalConfiguration config)
            : base(Constants.MultiClusterOracleId, silo)
        {
            if (sources == null)
            {
                throw new ArgumentNullException("sources");
            }
            if (silo == null)
            {
                throw new ArgumentNullException("silo");
            }

            logger              = LogManager.GetLogger("MultiClusterOracle");
            gossipChannels      = sources;
            localData           = new MultiClusterOracleData(logger);
            clusterId           = config.ClusterId;
            defaultMultiCluster = config.DefaultMultiCluster;
            random              = new SafeRandom();

            // to avoid convoying, each silo varies these period intervals a little
            backgroundGossipInterval = RandomizeTimespanSlightly(config.BackgroundGossipInterval);
            resendActiveStatusAfter  = RandomizeTimespanSlightly(ResendActiveStatusAfter);
        }