Ejemplo n.º 1
0
        public void Initialise(IConfigSource configSource)
        {
            IConfig config = configSource.Configs["EventRecorder"];

            m_decoratedRecorder.Initialise(configSource);

            int maxQueueSize = config.GetInt("MaxEventQueueSize", 5000);

            if (maxQueueSize <= 0)
            {
                throw new Exception(string.Format("MaxEventQueueSize must be > 0.  Value {0} is invalid", maxQueueSize));
            }
            else
            {
                m_log.DebugFormat("[EVENT RECORDER]: Using MaxEventQueueSize of {0}", maxQueueSize);
            }

            EventWriteTimeoutOnStop = config.GetInt("EventWriteTimeoutOnStop", 20000);

            if (EventWriteTimeoutOnStop < 0)
            {
                throw new Exception(
                          string.Format("EventWriteTimeoutOnStop must be >= 0.  Value {0} ms is invalid", EventWriteTimeoutOnStop));
            }
            else
            {
                m_log.DebugFormat("[EVENT RECORDER]: Using EventWriteTimeoutOnStop of {0} ms", EventWriteTimeoutOnStop);
            }

            m_eventWriteQueue
                = new BlockingCollection <IEvent>(new ConcurrentQueue <IEvent>(), maxQueueSize);
        }