Exemple #1
0
        protected override void DoStart()
        {
            log(MessageType.Info, "DoStart()", "Entering...");

            try
            {
                if (m_Pile == null)
                {
                    throw new PileCacheException(StringConsts.PILE_CACHE_SCV_START_PILE_NULL_ERROR);
                }

                if (m_Pile.ComponentDirector == this)
                {
                    m_Pile.Start();
                }
                else
                if (!m_Pile.Running)
                {
                    throw new PileCacheException(StringConsts.PILE_CACHE_SCV_START_PILE_NOT_STARTED_ERROR);
                }


                m_Tables.Clear();
                m_Pile.InstrumentationEnabled = m_InstrumentationEnabled;
                m_Pile.MaxMemoryLimit         = m_PileMaxMemoryLimit;
                m_Pile.AllocMode = m_PileAllocMode;


                m_Thread              = new Thread(threadSpin);
                m_Thread.Name         = THREAD_NAME;
                m_Thread.IsBackground = false;
                m_Trigger             = new AutoResetEvent(false);
                m_Thread.Start();
            }
            catch (Exception error)
            {
                AbortStart();

                if (m_Pile != null && m_Pile.ComponentDirector == this && m_Pile.Running)
                {
                    try { m_Pile.WaitForCompleteStop(); }
                    catch (Exception pe)
                    {
                        log(MessageType.Error, "DoStart().pileAbort", "Exception: " + pe.ToMessageWithType(), pe);
                    }
                }

                if (m_Thread != null)
                {
                    try
                    {
                        m_Thread.Join();
                        if (m_Trigger != null)
                        {
                            m_Trigger.Dispose();
                        }
                    } catch {}
                    m_Thread  = null;
                    m_Trigger = null;
                }

                log(MessageType.CatastrophicError, "DoStart()", "Exception: " + error.ToMessageWithType(), error);

                throw error;
            }
            log(MessageType.Info, "DoStart()", "...Exiting");
        }