internal WebEventBuffer(BufferedWebEventProvider provider, string bufferMode, WebEventBufferFlushCallback callback)
        {
            this._provider = provider;
            BufferModeSettings settings = RuntimeConfig.GetAppLKGConfig().HealthMonitoring.BufferModes[bufferMode];

            if (settings == null)
            {
                throw new ConfigurationErrorsException(System.Web.SR.GetString("Health_mon_buffer_mode_not_found", new object[] { bufferMode }));
            }
            if (settings.RegularFlushInterval == TimeSpan.MaxValue)
            {
                this._regularFlushIntervalMs = Infinite;
            }
            else
            {
                try
                {
                    this._regularFlushIntervalMs = (long)settings.RegularFlushInterval.TotalMilliseconds;
                }
                catch (OverflowException)
                {
                    this._regularFlushIntervalMs = Infinite;
                }
            }
            if (settings.UrgentFlushInterval == TimeSpan.MaxValue)
            {
                this._urgentFlushIntervalMs = Infinite;
            }
            else
            {
                try
                {
                    this._urgentFlushIntervalMs = (long)settings.UrgentFlushInterval.TotalMilliseconds;
                }
                catch (OverflowException)
                {
                    this._urgentFlushIntervalMs = Infinite;
                }
            }
            this._urgentFlushThreshold = settings.UrgentFlushThreshold;
            this._maxBufferSize        = settings.MaxBufferSize;
            this._maxFlushSize         = settings.MaxFlushSize;
            this._maxBufferThreads     = settings.MaxBufferThreads;
            this._burstWaitTimeMs      = Math.Min(this._burstWaitTimeMs, this._urgentFlushIntervalMs);
            this._flushCallback        = callback;
            this._buffer = new Queue();
            if (this._regularFlushIntervalMs != Infinite)
            {
                this._startTime            = DateTime.UtcNow;
                this._regularTimeoutUsed   = true;
                this._urgentFlushScheduled = false;
                this.SetTimer(this.GetNextRegularFlushDueTimeInMs());
            }
        }
 internal WebEventBuffer(BufferedWebEventProvider provider, string bufferMode, WebEventBufferFlushCallback callback)
 {
     this._provider = provider;
     BufferModeSettings settings = RuntimeConfig.GetAppLKGConfig().HealthMonitoring.BufferModes[bufferMode];
     if (settings == null)
     {
         throw new ConfigurationErrorsException(System.Web.SR.GetString("Health_mon_buffer_mode_not_found", new object[] { bufferMode }));
     }
     if (settings.RegularFlushInterval == TimeSpan.MaxValue)
     {
         this._regularFlushIntervalMs = Infinite;
     }
     else
     {
         try
         {
             this._regularFlushIntervalMs = (long) settings.RegularFlushInterval.TotalMilliseconds;
         }
         catch (OverflowException)
         {
             this._regularFlushIntervalMs = Infinite;
         }
     }
     if (settings.UrgentFlushInterval == TimeSpan.MaxValue)
     {
         this._urgentFlushIntervalMs = Infinite;
     }
     else
     {
         try
         {
             this._urgentFlushIntervalMs = (long) settings.UrgentFlushInterval.TotalMilliseconds;
         }
         catch (OverflowException)
         {
             this._urgentFlushIntervalMs = Infinite;
         }
     }
     this._urgentFlushThreshold = settings.UrgentFlushThreshold;
     this._maxBufferSize = settings.MaxBufferSize;
     this._maxFlushSize = settings.MaxFlushSize;
     this._maxBufferThreads = settings.MaxBufferThreads;
     this._burstWaitTimeMs = Math.Min(this._burstWaitTimeMs, this._urgentFlushIntervalMs);
     this._flushCallback = callback;
     this._buffer = new Queue();
     if (this._regularFlushIntervalMs != Infinite)
     {
         this._startTime = DateTime.UtcNow;
         this._regularTimeoutUsed = true;
         this._urgentFlushScheduled = false;
         this.SetTimer(this.GetNextRegularFlushDueTimeInMs());
     }
 }
        internal WebEventBuffer(BufferedWebEventProvider provider, string bufferMode,
                                WebEventBufferFlushCallback callback)
        {
            Debug.Assert(callback != null, "callback != null");

            _provider = provider;

            HealthMonitoringSection section = RuntimeConfig.GetAppLKGConfig().HealthMonitoring;

            BufferModesCollection bufferModes = section.BufferModes;

            BufferModeSettings bufferModeInfo = bufferModes[bufferMode];

            if (bufferModeInfo == null)
            {
                throw new ConfigurationErrorsException(SR.GetString(SR.Health_mon_buffer_mode_not_found, bufferMode));
            }

            if (bufferModeInfo.RegularFlushInterval == TimeSpan.MaxValue)
            {
                _regularFlushIntervalMs = Infinite;
            }
            else
            {
                try {
                    _regularFlushIntervalMs = (long)bufferModeInfo.RegularFlushInterval.TotalMilliseconds;
                }
                catch (OverflowException) {
                    _regularFlushIntervalMs = Infinite;
                }
            }

            if (bufferModeInfo.UrgentFlushInterval == TimeSpan.MaxValue)
            {
                _urgentFlushIntervalMs = Infinite;
            }
            else
            {
                try {
                    _urgentFlushIntervalMs = (long)bufferModeInfo.UrgentFlushInterval.TotalMilliseconds;
                }
                catch (OverflowException) {
                    _urgentFlushIntervalMs = Infinite;
                }
            }

            _urgentFlushThreshold = bufferModeInfo.UrgentFlushThreshold;
            _maxBufferSize        = bufferModeInfo.MaxBufferSize;
            _maxFlushSize         = bufferModeInfo.MaxFlushSize;
            _maxBufferThreads     = bufferModeInfo.MaxBufferThreads;

            _burstWaitTimeMs = Math.Min(_burstWaitTimeMs, _urgentFlushIntervalMs);

            _flushCallback = callback;

            _buffer = new Queue();

            if (_regularFlushIntervalMs != Infinite)
            {
                _startTime            = DateTime.UtcNow;
                _regularTimeoutUsed   = true;
                _urgentFlushScheduled = false;
                SetTimer(GetNextRegularFlushDueTimeInMs());
            }

            Debug.Trace("WebEventBuffer",
                        "\n_regularFlushIntervalMs=" + _regularFlushIntervalMs +
                        "\n_urgentFlushThreshold=" + _urgentFlushThreshold +
                        "\n_maxBufferSize=" + _maxBufferSize +
                        "\n_maxFlushSize=" + _maxFlushSize +
                        "\n_urgentFlushIntervalMs=" + _urgentFlushIntervalMs);
        }
Exemplo n.º 4
0
        internal WebEventBuffer(BufferedWebEventProvider provider, string bufferMode,
                        WebEventBufferFlushCallback callback) {
            Debug.Assert(callback != null, "callback != null");

            _provider = provider;
            
            HealthMonitoringSection section = RuntimeConfig.GetAppLKGConfig().HealthMonitoring;

            BufferModesCollection bufferModes = section.BufferModes;

            BufferModeSettings bufferModeInfo = bufferModes[bufferMode];
            if (bufferModeInfo == null) {
                throw new ConfigurationErrorsException(SR.GetString(SR.Health_mon_buffer_mode_not_found, bufferMode));
            }

            if (bufferModeInfo.RegularFlushInterval == TimeSpan.MaxValue) {
                _regularFlushIntervalMs = Infinite;
            }
            else {
                try {
                    _regularFlushIntervalMs = (long)bufferModeInfo.RegularFlushInterval.TotalMilliseconds;
                }
                catch (OverflowException) {
                    _regularFlushIntervalMs = Infinite;
                }
            }
            
            if (bufferModeInfo.UrgentFlushInterval == TimeSpan.MaxValue) {
                _urgentFlushIntervalMs = Infinite;
            }
            else {
                try {
                    _urgentFlushIntervalMs = (long)bufferModeInfo.UrgentFlushInterval.TotalMilliseconds;
                }
                catch (OverflowException) {
                    _urgentFlushIntervalMs = Infinite;
                }
            }

            _urgentFlushThreshold = bufferModeInfo.UrgentFlushThreshold;
            _maxBufferSize = bufferModeInfo.MaxBufferSize;
            _maxFlushSize = bufferModeInfo.MaxFlushSize;
            _maxBufferThreads = bufferModeInfo.MaxBufferThreads;

            _burstWaitTimeMs = Math.Min(_burstWaitTimeMs, _urgentFlushIntervalMs);
            
            _flushCallback = callback;

            _buffer = new Queue();

            if (_regularFlushIntervalMs != Infinite) {
                _startTime = DateTime.UtcNow;
                _regularTimeoutUsed = true;
                _urgentFlushScheduled = false;
                SetTimer(GetNextRegularFlushDueTimeInMs());
            }

            Debug.Trace("WebEventBuffer",   
                        "\n_regularFlushIntervalMs=" + _regularFlushIntervalMs +
                        "\n_urgentFlushThreshold=" + _urgentFlushThreshold +
                        "\n_maxBufferSize=" + _maxBufferSize +
                        "\n_maxFlushSize=" + _maxFlushSize +
                        "\n_urgentFlushIntervalMs=" + _urgentFlushIntervalMs);
        }