public void Execute(JobExecutionContext context) { try { //============================================================================= log.InfoFormat(AppResource.StartJobExecution, typeof(ContentMonitorJob).Name); //============================================================================= // Deserialize the given JSON to the version list // Make sure the JobDataMap carries only value type here // to prevent the concurrency issue when using reference type List <string> listVersion = ContentGenJob.GetContentVersionList(context.JobDetail.Name); // Do the monitoring string sJson = ProcessContentMonitor(listVersion, context); // Add returned content detail (JSON) into the job data map to avoid the concurrency issue context.JobDetail.JobDataMap[ContentMonitorJobDataMapConstants.ContentDetail] = sJson; //============================================================================= log.InfoFormat(AppResource.EndJobExecution, typeof(ContentMonitorJob).Name); //============================================================================= } catch (Exception oEx) { // Remove the entry from the job data map to refresh the content details context.JobDetail.JobDataMap.Remove(ContentMonitorJobDataMapConstants.ContentDetail); //=================================================================================================== log.ErrorFormat(AppResource.JobExecutionFailed, oEx, typeof(ContentMonitorJob).Name, oEx.Message); //=================================================================================================== } }
private static ContentGenRecipes GetContentRecipes(string sContentUniqueId, string sContentHashCode) { string sRecipesJson = ContentGenJob.ReadContentRecipesJson(sContentUniqueId, sContentHashCode); if (sRecipesJson != null) { return(ContentGenRecipes.FromJson(sRecipesJson)); } return(null); }
private static DateTime GetContentCreateDate(string sContentUniqueId) { string sDate = ContentGenJob.GetContentCreateDate(sContentUniqueId); if (sDate != null) { return(DateTime.Parse(sDate)); } return(DateTime.Now); }