/// <summary>
        /// Creates a thread buffer.
        /// </summary>
        private GThreadBuffer CreateThreadBuffer()
        {
            GThreadBuffer oThreadBuffer = new GThreadBuffer(_threadBufferCapacity);

            oThreadBuffer.Full += new FullEventHandler(ThreadBuffer_Full);
            return(oThreadBuffer);
        }
        /// <summary>
        /// Constructor that takes the thread buffer capacity.
        /// </summary>
        /// <param name="nThreadBufferCapacity">thread buffer capacity</param>
        public GApplicationBuffered(int nThreadBufferCapacity) : base(true)
        {
            if (nThreadBufferCapacity < 1)
            {
                throw new ArgumentOutOfRangeException("nThreadBufferCapacity", nThreadBufferCapacity, "0 < nThreadBufferCapacity <= Int32.MaxValue");
            }

            m_nThreadBufferCapacity = nThreadBufferCapacity;
            m_oThreadBuffer         = CreateThreadBuffer();
        }
        /// <summary>
        /// Constructor that takes the thread buffer capacity.
        /// </summary>
        /// <param name="threadBufferCapacity">thread buffer capacity</param>
        public GApplicationBuffered(int threadBufferCapacity)
            : base(true)
        {
            if (threadBufferCapacity < 1)
            {
                throw new ArgumentOutOfRangeException("threadBufferCapacity", threadBufferCapacity, "0 < threadBufferCapacity <= Int32.MaxValue");
            }

            _threadBufferCapacity = threadBufferCapacity;
            _ThreadBuffer         = CreateThreadBuffer();
        }
        /// <summary>
        /// Fires the thread failed event.
        /// </summary>
        /// <param name="thread">thread</param>
        /// <param name="ex">exception</param>
        protected override void OnThreadFailed(GThread thread, Exception ex)
        {
            GThreadBuffer oThreadBuffer = thread as GThreadBuffer;

            if (oThreadBuffer != null)
            {
                foreach (GThread oThread1 in oThreadBuffer)
                {
                    base.OnThreadFailed(oThread1, ex);
                }
            }
        }
        /// <summary>
        /// Fires the thread failed event.
        /// </summary>
        /// <param name="oThread0">thread</param>
        /// <param name="oException">exception</param>
        protected override void OnThreadFailed(GThread oThread0, Exception oException)
        {
            GThreadBuffer oThreadBuffer = oThread0 as GThreadBuffer;

            if (oThreadBuffer != null)
            {
                foreach (GThread oThread1 in oThreadBuffer)
                {
                    base.OnThreadFailed(oThread1, oException);
                }
            }
        }
        /// <summary>
        /// Flushes the thread buffer by sending the thread buffer to the manager as one thread.
        /// </summary>
        public void FlushThreads()
        {
            lock (this)
            {
                // check whether any threads to flush...
                if (_ThreadBuffer.Count > 0)
                {
                    // remove full event handler from thread buffer...
                    _ThreadBuffer.Full -= new FullEventHandler(ThreadBuffer_Full);

                    // start thread buffer thread...
                    base.StartThread(_ThreadBuffer);

                    // create new thread buffer...
                    _ThreadBuffer = CreateThreadBuffer();
                }
            }
        }
        /// <summary>
        /// Fires the thread finish event.
        /// </summary>
        /// <param name="thread">thread</param>
        protected override void OnThreadFinish(GThread thread)
        {
            GThreadBuffer oThreadBuffer = thread as GThreadBuffer;

            if (oThreadBuffer != null)
            {
                foreach (GThread oThread1 in oThreadBuffer)
                {
                    Exception oException = oThreadBuffer.GetException(oThread1.Id);
                    if (oException == null)
                    {
                        base.OnThreadFinish(oThread1);
                    }
                    else
                    {
                        base.OnThreadFailed(oThread1, oException);
                    }
                }
            }
        }
        /// <summary>
        /// Constructor that takes the thread buffer capacity.
        /// </summary>
        /// <param name="nThreadBufferCapacity">thread buffer capacity</param>
        public GApplicationBuffered(int nThreadBufferCapacity)
            : base(true)
        {
            if (nThreadBufferCapacity < 1)
            {
                throw new ArgumentOutOfRangeException("nThreadBufferCapacity", nThreadBufferCapacity, "0 < nThreadBufferCapacity <= Int32.MaxValue");
            }

            m_nThreadBufferCapacity = nThreadBufferCapacity;
            m_oThreadBuffer = CreateThreadBuffer();
        }
 /// <summary>
 /// Creates a thread buffer.
 /// </summary>
 private GThreadBuffer CreateThreadBuffer()
 {
     GThreadBuffer oThreadBuffer = new GThreadBuffer(m_nThreadBufferCapacity);
     oThreadBuffer.Full += new FullEventHandler(oThreadBuffer_Full);
     return oThreadBuffer;
 }
        /// <summary>
        /// Flushes the thread buffer by sending the thread buffer to the manager as one thread.
        /// </summary>
        public void FlushThreads()
        {
            lock (this)
            {
                // check whether any threads to flush...
                if (m_oThreadBuffer.Count > 0)
                {
                    // remove full event handler from thread buffer...
                    m_oThreadBuffer.Full -= new FullEventHandler(oThreadBuffer_Full);

                    // start thread buffer thread...
                    base.StartThread(m_oThreadBuffer);

                    // create new thread buffer...
                    m_oThreadBuffer = CreateThreadBuffer();
                }
            }
        }
        /// <summary>
        /// Constructor that takes the thread buffer capacity.
        /// </summary>
        /// <param name="threadBufferCapacity">thread buffer capacity</param>
        public GApplicationBuffered(int threadBufferCapacity)
            : base(true)
        {
            if (threadBufferCapacity < 1)
            {
                throw new ArgumentOutOfRangeException("threadBufferCapacity", threadBufferCapacity, "0 < threadBufferCapacity <= Int32.MaxValue");
            }

            _threadBufferCapacity = threadBufferCapacity;
            _ThreadBuffer = CreateThreadBuffer();
        }