Beispiel #1
0
        /// <summary>
        /// Timer's delay timeout expired; Execute first Task is tasks list
        /// </summary>
        private void OnNextEvent() // obj ignored
        {
            while (true)
            {
                lock (m_Triggers)
                {
                    if (m_Triggers.Count == 0)
                    {
                        return;
                    }

                    ITrigger trigger = m_Triggers[0];
                    if (Log.IsDebugEnabled)
                    {
                        Log.Debug(string.Format("Kicked by trigger {0}", trigger.Name));
                    }

                    if (trigger.Active && trigger.NextDateTime <= DateTime.Now)
                    {
                        Execute(trigger.Jobs);
                    }

                    trigger.RecalculateNextDateTime();
                    m_Triggers.Sort(comparer);
                }
                Thread.Sleep(GetNextWakeTime());
                Thread.Sleep(100);
            }
        }