Ejemplo n.º 1
0
 /// <summary>
 /// Request the state machine to run, if required.
 /// </summary>
 private void RequestRun()
 {
     if (WantToRunNow() && m_wakeUpMsg == null)
     {
         m_wakeUpMsg = new KmodBrokerWakeUpMsg(this);
         KBase.ExecInUI(new KBase.EmptyDelegate(m_wakeUpMsg.Run));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Run the broker state machine. Only call RequestRun() to execute
        /// this method.
        /// </summary>
        public void Run()
        {
            Debug.Assert(m_wakeUpMsg != null);

            try
            {
                // Loop until our state stabilize.
                while (WantToRunNow())
                {
                    Debug.Assert(m_curTransaction == null);
                    Debug.Assert(m_curCommand == null);

                    // We're disabled. Kill all transactions.
                    if (!m_enabledFlag)
                    {
                        Killall(new Exception("KMOD broker disabled"));
                    }

                    // Execute the next transaction.
                    else
                    {
                        m_curTransaction = m_transactionQueue[0];
                        m_transactionQueue.RemoveAt(0);
                        Debug.Assert(m_curTransaction.Status == KmodTransactionStatus.Queued);
                        m_curTransaction.Status = KmodTransactionStatus.Executing;

                        // We have to start KMOD.
                        if (m_curThread == null)
                        {
                            StartKmodThread();
                        }

                        // Execute the current transaction.
                        else
                        {
                            StartCurrentTransaction();
                        }
                    }
                }
            }

            // We cannot recover from these errors.
            catch (Exception ex)
            {
                KBase.HandleException(ex, true);
            }

            m_wakeUpMsg = null;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Run the broker state machine. Only call RequestRun() to execute
        /// this method.
        /// </summary>
        public void Run()
        {
            Debug.Assert(m_wakeUpMsg != null);

            try
            {
                // Loop until our state stabilize.
                while (WantToRunNow())
                {
                    Debug.Assert(m_curTransaction == null);
                    Debug.Assert(m_curCommand == null);

                    // We're disabled. Kill all transactions.
                    if (!m_enabledFlag)
                        Killall(new Exception("KMOD broker disabled"));

                    // Execute the next transaction.
                    else
                    {
                        m_curTransaction = m_transactionQueue[0];
                        m_transactionQueue.RemoveAt(0);
                        Debug.Assert(m_curTransaction.Status == KmodTransactionStatus.Queued);
                        m_curTransaction.Status = KmodTransactionStatus.Executing;

                        // We have to start KMOD.
                        if (m_curThread == null) StartKmodThread();

                        // Execute the current transaction.
                        else StartCurrentTransaction();
                    }
                }
            }

            // We cannot recover from these errors.
            catch (Exception ex)
            {
                KBase.HandleException(ex, true);
            }

            m_wakeUpMsg = null;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Request the state machine to run, if required.
 /// </summary>
 private void RequestRun()
 {
     if (WantToRunNow() && m_wakeUpMsg == null)
     {
         m_wakeUpMsg = new KmodBrokerWakeUpMsg(this);
         KBase.ExecInUI(new KBase.EmptyDelegate(m_wakeUpMsg.Run));
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Request the state machine to run, if required.
 /// </summary>
 private void RequestRun()
 {
     if (WantToRunNow() && m_wakeUpMsg == null)
     {
         m_wakeUpMsg = new KmodBrokerWakeUpMsg(this);
         Misc.MainForm.BeginInvoke(new Base.EmptyDelegate(m_wakeUpMsg.Run));
     }
 }