示例#1
0
        public JobMessage(IJobContext jobContext) : base(jobContext, JOB_TYPE.MESSAGE)
        {
            //this.Messages = new QueueThreadSafe<Message>();

            //this.ResponseIds = new QueueThreadSafe<Guid>();
            //this.ResponseMessages = new DictionaryThreadSafe<Guid, Message>();
            //this.RequestMessageGroup = new DictionaryThreadSafe<Guid, List<Guid>>();
            //this.RequestMessageGroupTotal = new DictionaryThreadSafe<Guid, int>();

            this.MessagesRequest = new DictionaryThreadSafe <Guid, Message>();
            this.MessagesRequestTimeOutExpire = new ListThreadSafe <Guid>();
            this.MessagesRequestTimeOut       = new ListDoubleThreadSafe <long, Guid>();
            this.timer = new System.Threading.Timer(new System.Threading.TimerCallback((obj) =>
            {
                if (this.MessagesRequestTimeOut.Count == 0)
                {
                    return;
                }

                long timeStart = DateTime.Now.Ticks / 1000;
                Guid[] ids     = this.MessagesRequestTimeOut.FindItem1LessThanAndRemove(FUNC_TIME_OUT_FILTER, timeStart);
                if (ids.Length > 0)
                {
                    foreach (var t in ids)
                    {
                        Tracer.WriteLine("RESPONSE TIME_OUT: {0}", t);
                    }

                    this.MessagesRequestTimeOutExpire.AddRange(ids);
                }
            }), null, 100, 100);
        }
示例#2
0
 public JobSpeechEN(IJobStore _store)
 {
     this.StoreJob  = _store;
     this.queue     = new QueueThreadSafe <string>();
     this.storeUrl  = new DictionaryThreadSafe <string, string>();
     this.storePath = new DictionaryThreadSafe <string, string>();
 }
示例#3
0
        public JobStore()
        {
            #region [ JOB ]
            jobEvents   = new DictionaryThreadSafe <int, AutoResetEvent>();
            jobInfos    = new DictionaryThreadSafe <int, JobInfo>();
            jobGroups   = new DictionaryThreadSafe <string, ListThreadSafe <int> >();
            listIdsStop = new ListThreadSafe <int>();
            #endregion

            #region [ MESSAGE ]
            msgCacheData = new DictionaryThreadSafe <Guid, object>();
            msgCache     = new DictionaryThreadSafe <Guid, Message>();
            msgInfo      = new JobInfo(new JobMessage(this), new AutoResetEvent(false));
            f_addGroupJobName(msgInfo.f_getJob());
            #endregion

            #region [ FORM ]
            storeForms = new DictionaryThreadSafe <int, IFORM>();
            #endregion

            #region [ URL ]
            urlFail    = new DictionaryThreadSafe <string, string>();
            urlOk      = new DictionaryThreadSafe <string, string>();
            urlPending = new ListThreadSafe <string>();
            urlAll     = new ListThreadSafe <string>();
            f_url_Init();
            #endregion

            f_addJob(new JobLink(this));
        }
示例#4
0
        public JobFactory(JOB_TYPE type)
        {
            this.Messages = new QueueThreadSafe <Message>();

            this.Type  = type;
            JobHandles = new DictionaryThreadSafe <int, IJobHandle>();
        }
示例#5
0
 public JobLink(IJobStore _store)
 {
     this.StoreJob = _store;
     list          = new ListThreadSafe <oLink>();
     msg           = new QueueThreadSafe <Message>();
     urlData       = new DictionaryThreadSafe <string, string>();
 }
示例#6
0
 public JobFileHttp(IJobAction jobAction) : base(JOB_TYPE.FILE_HTTP_CACHE, jobAction)
 {
     msg      = new QueueThreadSafe <Message>();
     fileData = new DictionaryThreadSafe <string, string>();
     server   = new HttpServer();
     server.RequestReceived += f_server_onRequestReceived;
 }
示例#7
0
 public JobLink(IJobAction jobAction) : base(JOB_TYPE.LINK, jobAction)
 {
     list    = new ListThreadSafe <oLink>();
     msg     = new QueueThreadSafe <Message>();
     urlData = new DictionaryThreadSafe <string, string>();
 }