コード例 #1
0
        public void DequeueWorker()
        {
            while (KeepAlive)
            {
                IQueueItem item;
                try
                {
                    foreach (var entry in MQ)
                    {
                        var q = entry.Value;

                        if (q.TryDequeue(out item))
                        {
                            EventQueue.Enqueue(item);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Netlog.Exception("Topic Dequeue Worker error ", ex);
                }

                Thread.Sleep(DequeueInterval);
            }
            Netlog.Warn("Topic Dequeue Worker stoped!");
        }
コード例 #2
0
 private void InternalStart()
 {
     while (KeepAlive)
     {
         DoSync();
         Thread.Sleep(1000);
     }
     Netlog.Warn("Initialized SyncTaskBox Not keep alive");
 }
コード例 #3
0
        //public void Add(SyncTask task, DataSyncEntity entity, IDataCache owner)
        //{
        //    if (task == null || entity == null || owner == null)
        //    {

        //        this.LogAction(CacheAction.SyncTime, CacheActionState.Failed, "SyncTaskBox can not add task null!");
        //        return;
        //    }
        //    Add(new SyncBoxTask()
        //        {
        //            Entity = entity,
        //            //ItemName = task.ItemName,
        //            Owner = owner
        //            //TaskItem = task.Item
        //        });
        //}

        public void Add(ISyncTask item)
        {
            if (item == null)
            {
                Netlog.Warn("SyncTaskBox can not add task null!");
                return;
            }

            m_SynBox.Enqueue(item);
            Netlog.DebugFormat("SyncTaskBox Added SyncBoxTask {0}", item.ItemName);
        }
コード例 #4
0
 public void SenderWorker()
 {
     while (KeepAlive)
     {
         IQueueItem item;
         try
         {
             if (EventQueue.TryDequeue(out item))
             {
                 Send(item.Host, item as QueueItem);
             }
         }
         catch (Exception ex)
         {
             Netlog.Exception("Topic Sender Worker error ", ex);
         }
         Thread.Sleep(SenderInterval);
     }
     Netlog.Warn("Topic Sender Worker stoped!");
 }