コード例 #1
0
 private static CircuitRegistry CreateRegistry(CircuitIdFactory factory = null)
 {
     return(new CircuitRegistry(
                Options.Create(new CircuitOptions()),
                NullLogger <CircuitRegistry> .Instance,
                factory ?? TestCircuitIdFactory.CreateTestFactory()));
 }
コード例 #2
0
 public DefaultCircuitFactory(
     IServiceScopeFactory scopeFactory,
     ILoggerFactory loggerFactory,
     CircuitIdFactory circuitIdFactory)
 {
     _scopeFactory     = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory));
     _loggerFactory    = loggerFactory;
     _circuitIdFactory = circuitIdFactory ?? throw new ArgumentNullException(nameof(circuitIdFactory));
 }
コード例 #3
0
 public CircuitFactory(
     IServiceScopeFactory scopeFactory,
     ILoggerFactory loggerFactory,
     CircuitIdFactory circuitIdFactory,
     IOptions <CircuitOptions> options)
 {
     _scopeFactory     = scopeFactory;
     _loggerFactory    = loggerFactory;
     _circuitIdFactory = circuitIdFactory;
     _options          = options.Value;
     _logger           = _loggerFactory.CreateLogger <CircuitFactory>();
 }
コード例 #4
0
 public DefaultCircuitFactory(
     IServiceScopeFactory scopeFactory,
     ILoggerFactory loggerFactory,
     CircuitIdFactory circuitIdFactory,
     IOptions <CircuitOptions> options)
 {
     _scopeFactory     = scopeFactory ?? throw new ArgumentNullException(nameof(scopeFactory));
     _loggerFactory    = loggerFactory;
     _logger           = _loggerFactory.CreateLogger <CircuitFactory>();
     _circuitIdFactory = circuitIdFactory ?? throw new ArgumentNullException(nameof(circuitIdFactory));
     _options          = options.Value;
 }
コード例 #5
0
        public CircuitRegistry(
            IOptions <CircuitOptions> options,
            ILogger <CircuitRegistry> logger,
            CircuitIdFactory circuitIdFactory)
        {
            _options          = options.Value;
            _logger           = logger;
            _circuitIdFactory = circuitIdFactory;
            ConnectedCircuits = new ConcurrentDictionary <string, CircuitHost>(StringComparer.Ordinal);

            DisconnectedCircuits = new MemoryCache(new MemoryCacheOptions
            {
                SizeLimit = _options.DisconnectedCircuitMaxRetained,
            });

            _postEvictionCallback = new PostEvictionCallbackRegistration
            {
                EvictionCallback = OnEntryEvicted,
            };
        }
コード例 #6
0
 public TestCircuitRegistry(CircuitIdFactory factory)
     : base(Options.Create(new CircuitOptions()), NullLogger <CircuitRegistry> .Instance, factory)
 {
 }