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); }
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)); }
public JobLink(IJobStore _store) { this.StoreJob = _store; list = new ListThreadSafe <oLink>(); msg = new QueueThreadSafe <Message>(); urlData = new DictionaryThreadSafe <string, string>(); }
private void f_addGroupJobName(IJob job) { int _id = job.f_getId(); string groupName = job.f_getGroupName(); if (!string.IsNullOrEmpty(groupName)) { if (jobGroups.ContainsKey(groupName)) { ListThreadSafe <int> ls = jobGroups[groupName]; ls.Add(_id); } else { List <int> lsId = new List <int>() { _id }; jobGroups.Add(groupName, lsId); } } }
public JobMessage(IJobStore _store) { this.StoreJob = _store; list = new ListThreadSafe <oLink>(); msg = new QueueThreadSafe <Message>(); }
public JobLink(IJobAction jobAction) : base(JOB_TYPE.LINK, jobAction) { list = new ListThreadSafe <oLink>(); msg = new QueueThreadSafe <Message>(); urlData = new DictionaryThreadSafe <string, string>(); }