public override void PowerOn() { Log.Info("PowerOn"); List <BaseAggConfig> configs = BaseAggConfig.Create(SeclureCloudDbHelper.Instance().Accessor.GetConfig()); jobManage = new AggJobManage(configs); jobManage.StartWork(); }
public void Execute(IJobExecutionContext context) { IJobDetail jobDetail = context.JobDetail; JobInfo jobInfo = AggJobManage.GetJobInfo(jobDetail); if (jobInfo == null || jobInfo.DataPool == null || jobInfo.Process == null || jobInfo.ConsumerService == null) { log.InfoFormat("aggJob id:{0},start working failed, para is null.", jobDetail.Key); return; } log.InfoFormat("aggJob id:{0},start working sucessful!", jobDetail.Key); AggRawData newDatas; try { newDatas = jobInfo.DataPool.GetAggRawData(DateTime.Now); } catch (Exception e) { log.InfoFormat("aggJob id:{0},get data error! error:{1}, trace{2}", jobDetail.Key, e.Message, e.StackTrace); log.InfoFormat("aggJob id:{0},working finished!", jobDetail.Key); return; } log.InfoFormat("aggJob id:{0},get data finished!", jobDetail.Key); AggResult aggResults; try { aggResults = jobInfo.Process.AggProcess(newDatas); } catch (Exception e) { log.InfoFormat("aggJob id:{0},agg process error! error:{1}, trace{2}", jobDetail.Key, e.Message, e.StackTrace); log.InfoFormat("aggJob id:{0},working finished!", jobDetail.Key); return; } log.InfoFormat("aggJob id:{0},agg process finished!", jobDetail.Key); try { jobInfo.ConsumerService.OnAggResultProduced(aggResults); } catch (Exception e) { log.InfoFormat("aggJob id:{0},result consumers process error! error:{1}, trace{2}", jobDetail.Key, e.Message, e.StackTrace); } log.InfoFormat("aggJob id:{0},working finished!", jobDetail.Key); }
//private static object _lock = new object(); //private static TaskManage instance; public TaskManage(List <BaseAggConfig> aggConfigs, AggJobManage manage) { }