Пример #1
0
        public Publisher(PublisherSettings settings, IHandlerSource handlerSource, IDispatcher[] dispatchers)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (handlerSource == null)
            {
                throw new ArgumentNullException("handlerSource");
            }

            if (dispatchers == null)
            {
                throw new ArgumentNullException("dispatchers");
            }

            if (dispatchers.Any(x => ReferenceEquals(x, null)))
            {
                throw new ArgumentException("At least one of dispatches is null.", "dispatchers");
            }

            _settings = settings;
            _handlerSource = handlerSource;
            _dispatchers = dispatchers;
        }
        public virtual void RemoveSource(IHandlerSource handlerSource)
        {
            lock (_latch)
            {
                if (!_sources.Contains(handlerSource))
                {
                    return;
                }

                var newSources = _sources.Except(new[] {handlerSource}).ToArray();

                Interlocked.Exchange(ref _sources, newSources);
            }
        }
        public virtual void AddSource(IHandlerSource handlerSource)
        {
            lock (_latch)
            {
                if (_sources.Contains(handlerSource))
                {
                    return;
                }

                var newSources = new IHandlerSource[_sources.Length + 1];
                _sources.CopyTo(newSources,0);
                newSources[_sources.Length] = handlerSource;

                Interlocked.Exchange(ref _sources, newSources);
            }
        }
Пример #4
0
 public void Add(IHandlerSource source)
 {
     _handlers.HandlerSources.Add(source);
 }
Пример #5
0
 public void Add(IHandlerSource source)
 {
     _handlers.HandlerSources.Add(source);
 }
Пример #6
0
 public IHandlerSetup AddSource(IHandlerSource source)
 {
     Assert.ArgumentNotNull(source, nameof(source));
     _sources.Add(source);
     return(this);
 }
Пример #7
0
 public void FindBy(IHandlerSource source)
 {
     _parent.Config.Add(source);
 }
Пример #8
0
 public void FindBy(IHandlerSource source)
 {
     _parent._sources.Add(source);
 }
Пример #9
0
 public Publisher(IHandlerSource handlerSource, IDispatcher[] dispatchers)
     : this(PublisherSettings.Default, handlerSource, dispatchers)
 {
 }