public Evaluator(RouterConfig config, IRouteCompiler compiler) { Preconditions.CheckNotNull(config, nameof(config)); this.compiler = Preconditions.CheckNotNull(compiler); this.fallback = config.Fallback.Map(this.Compile); ImmutableDictionary <string, CompiledRoute> routesDict = config .Routes .ToImmutableDictionary(r => r.Id, r => this.Compile(r)); this.compiledRoutes = new AtomicReference <ImmutableDictionary <string, CompiledRoute> >(routesDict); }
public FilteringRoutingService(IRoutingService underlying, IRouteStore routeStore, INotifierFactory notifierFactory, IRouteCompiler compiler) { this.underlying = Preconditions.CheckNotNull(underlying, nameof(underlying)); this.routeStore = Preconditions.CheckNotNull(routeStore, nameof(routeStore)); this.notifierFactory = Preconditions.CheckNotNull(notifierFactory, nameof(notifierFactory)); this.compiler = Preconditions.CheckNotNull(compiler, nameof(compiler)); this.evaluators = new AtomicReference <ImmutableDictionary <string, Evaluator> >(ImmutableDictionary <string, Evaluator> .Empty); this.notifiers = new AtomicReference <ImmutableDictionary <string, INotifier> >(ImmutableDictionary <string, INotifier> .Empty); this.cts = new CancellationTokenSource(); this.closed = new AtomicBoolean(false); this.sync = new AsyncLock(); }