Exemplo n.º 1
0
        public ClusterContext(ICluster cluster, CancellationTokenSource tokenSource, ClusterOptions options)
        {
            Cluster        = cluster;
            ClusterOptions = options;
            _tokenSource   = tokenSource;

            // Register this instance of ClusterContext
            options.AddSingletonService(this);

            // Register the ClusterOptions
            options.AddSingletonService(options);

            ServiceProvider = options.BuildServiceProvider();

            _logger             = ServiceProvider.GetRequiredService <ILogger <ClusterContext> >();
            _configHandler      = ServiceProvider.GetRequiredService <IConfigHandler>();
            _clusterNodeFactory = ServiceProvider.GetRequiredService <IClusterNodeFactory>();
        }