Пример #1
0
 internal StandardChannel( IGrandOutputSink commonSink, EventDispatcher dispatcher, IRouteConfigurationLock configLock, HandlerBase[] handlers, string configurationName, GrandOutputChannelConfigData configData )
 {
     _dispatcher = dispatcher;
     _receiver = new EventDispatcher.FinalReceiver( commonSink, handlers, configLock );
     _receiverNoCommonSink = new EventDispatcher.FinalReceiver( null, handlers, configLock );
     _configurationName = configurationName;
     if( configData != null ) _minimalFilter = configData.MinimalFilter;
 }
Пример #2
0
 internal BufferingChannel( EventDispatcher dispatcher, EventDispatcher.FinalReceiver commonSinkOnly )
 {
     _dispatcher = dispatcher;
     _receiver = commonSinkOnly;
     _useLock = new CountdownEvent( 0 );
     _buffer = new ConcurrentQueue<GrandOutputEventInfo>();
     _flushLock = new Object();
 }
Пример #3
0
        /// <summary>
        /// Initializes a new <see cref="GrandOutput"/>. 
        /// </summary>
        /// <param name="dispatcherStrategy">Strategy to use to handle the throughput.</param>
        public GrandOutput( IGrandOutputDispatcherStrategy dispatcherStrategy = null )
        {
            _clients = new List<WeakReference<GrandOutputClient>>();
            _dispatcher = new EventDispatcher( dispatcherStrategy ?? new EventDispatcherBasicStrategy(), null );
            CommonSink = new GrandOutputCompositeSink();
            var factory = new ChannelFactory( this, _dispatcher );
            _channelHost = new ChannelHost( factory, OnConfigurationReady );
            _channelHost.ConfigurationClosing += OnConfigurationClosing;
            _bufferingChannel = new BufferingChannel( _dispatcher, factory.CommonSinkOnlyReceiver );
            _nextDeadClientGarbage = DateTime.UtcNow.AddMinutes( 5 );

            // TODO: Adapt this termination handling to dotnet.
            var h = new EventHandler( OnDomainTermination );
            AppDomain.CurrentDomain.DomainUnload += h;
            AppDomain.CurrentDomain.ProcessExit += h;
        }