Exemplo n.º 1
0
        private void WriteToQueue(string value, bool isNewLine)
        {
            if (value != null)
            {
                if (isNewLine)
                {
                    value = value + NewLine;
                }

                ItemQueue.Enqueue(value);
                _queued?.Invoke(this, EventArgs.Empty);
            }
        }
Exemplo n.º 2
0
        public void Start()
        {
            if (!IsRunning)
            {
                IsRunning = true;
                new System.Threading.Thread(() =>
                {
                    while (true)
                    {
                        bool check     = false;
                        bool condition = false;
                        lock (__queuelock)
                        {
                            condition = ItemQueue.Count < BufferingSize;
                        }

                        if (condition)
                        {
                            var item = Source.Congruence();
                            Get(ref item);
                            lock (__queuelock)
                            {
                                ItemQueue.Enqueue(item);
                            }
                            check = true;
                        }
                        if (!check)
                        {
                            System.Threading.Thread.Sleep(1);
                        }
                        else
                        {
                            //Console.WriteLine($"Reader : Load-> c/{ItemQueue.Count}");
                        }
                    }
                }).Start();
            }

            if (null == gcThread)
            {
                gcThread = new System.Threading.Thread(() =>
                {
                    while (true)
                    {
                        GC.Collect();
                        System.Threading.Thread.Sleep(1000);
                    }
                });
                gcThread.Start();
            }
        }
Exemplo n.º 3
0
        public void BeginStartup()
        {
            if (Show != null)
            {
                // Sort the items
                Show.Items.Sort((item1, item2) => item1.ItemOrder.CompareTo(item2.ItemOrder));
                foreach (Shows.ShowItem item in Show.GetItems(Shows.ShowItemType.Startup))
                {
                    ItemQueue.Enqueue(item);
                }

                ExecuteNextStartupItem();
            }
        }
Exemplo n.º 4
0
        public void BeginSequential()
        {
            ScheduleExecutor.Logging.Info("BeginSequential");
            if (Show != null && State == StateType.Running)
            {
                State = StateType.Running;

                foreach (Shows.ShowItem item in Show.GetItems(Shows.ShowItemType.Sequential))
                {
                    ScheduleExecutor.Logging.Info("BeginSequential: Enqueue:" + item.Name);
                    ItemQueue.Enqueue(item);
                }

                if (ItemQueue.Any())
                {
                    ExecuteNextSequentialItem();
                }
            }
        }
Exemplo n.º 5
0
        public void BeginShutdown()
        {
            if (Show != null)
            {
                ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Starting shutdown");

                StopBackground();
                StopSequential();
                ItemQueue.Clear();

                State = StateType.Shutdown;
                foreach (ShowItem item in Show.GetItems(Shows.ShowItemType.Shutdown))
                {
                    LogScheduleInfoEntry(string.Format("BeginShutdown: Enqueue: {0}", item.Name));
                    ItemQueue.Enqueue(item);
                }

                ExecuteNextShutdownItem();
            }
        }
Exemplo n.º 6
0
        public void BeginShutdown()
        {
            if (Show != null)
            {
                ScheduleExecutor.AddSchedulerLogEntry(Show.Name, "Starting shutdown");

                StopBackground();

                ItemQueue.Clear();

                State = StateType.Shutdown;
                foreach (Shows.ShowItem item in Show.GetItems(Shows.ShowItemType.Shutdown))
                {
                    ScheduleExecutor.Logging.Info("BeginShutdown: Enqueue: " + item.Name);
                    ItemQueue.Enqueue(item);
                }

                ExecuteNextShutdownItem();
            }
        }
Exemplo n.º 7
0
        public void BeginSequential()
        {
            LogScheduleInfoEntry("BeginSequential");
            if (Show != null && State == StateType.Running)
            {
                State = StateType.Running;

                foreach (ShowItem item in Show.GetItems(ShowItemType.Sequential))
                {
                    LogScheduleInfoEntry("BeginSequential: Enqueue:" + item.Name);
                    ItemQueue.Enqueue(item);
                }

                if (ItemQueue.Any())
                {
                    ExecuteNextSequentialItem();
                }
                else
                {
                    LogScheduleInfoEntry("BeginSequential: Nothing in queue.");
                }
            }
        }