/// <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; }
/// <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; }