Esempio n. 1
0
        public bool RegisterSchedule(EnumSchedule schedule, ScheduleDelegateParam scheduleDelegate)
        {
            if (_disableSchedule)
            {
                return(false);
            }
            var config = ScheduleConfig.Instance.GetEntity(schedule);

            if (config == null)
            {
                SystemlogMgr.Error("Schedule register", "can't find schedule config,id:" + (int)schedule);
                return(false);
            }
            ScheduleInfo info = new ScheduleInfo(scheduleDelegate, config);

            _rwl.AcquireWriterLock(Timeout.Infinite);
            try
            {
                _scheduleInfoDict.Add((int)schedule, info);
                LogHelper.Insert(schedule.ToString() + " register success.", LogType.Info);
            }
            finally
            {
                _rwl.ReleaseWriterLock();
            }
            return(true);
        }
Esempio n. 2
0
 public ConfigScheduleEntity GetEntity(EnumSchedule enumSchedule)
 {
     return(GetEntity((int)enumSchedule));
 }