本文整理汇总了C#中IJobExecutionContext.Get方法的典型用法代码示例。如果您正苦于以下问题:C# IJobExecutionContext.Get方法的具体用法?C# IJobExecutionContext.Get怎么用?C# IJobExecutionContext.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IJobExecutionContext
的用法示例。
在下文中一共展示了IJobExecutionContext.Get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JobWasExecuted
public void JobWasExecuted(IJobExecutionContext context, JobExecutionException jobException)
{
JobExecutionData data = context.Get("JobExecutionData") as JobExecutionData;
if (data != null)
{
data.JobEndTime = DateTime.Now;
lock (_Data)
{
if (_Data.Count > _Capacity)
{
_Data.RemoveAt(0);
}
_Data.Add(data);
}
}
}
示例2: OnExecute
private void OnExecute(IJobExecutionContext context)
{
Log4NetLogger.Instance.Info(string.Format("FileMonitoringJob with ID {0} Invoked.", jobSetting.Id));
try
{
jobSetting = (FileJobSetting)context.Get("JobSetting");
//TODO: Processing based on FileJobSetting and notification (DB and Live)
HubProxy.Invoke(AppSettingsValues.EventToAdmin, true, "FileMonitoringJob Executed on " + DateTime.Now);
}
catch (Exception ex)
{
Log4NetLogger.Instance.Error(ex);
}
Log4NetLogger.Instance.Info(string.Format("FileMonitoringJob with ID {0} Completed.", jobSetting.Id));
}
示例3: Execute
public void Execute(IJobExecutionContext context)
{
try
{
var urls = context.Get("urls").ToString().Split(',');
urls.ToList().ForEach(url =>
{
var request = (HttpWebRequest)WebRequest.Create(url);
var s = new Stopwatch();
s.Start();
using (var response = (HttpWebResponse)request.GetResponse())
using (var stream = response.GetResponseStream())
{
string ret = string.Empty;
if (stream != null)
{
string readToEnd = new StreamReader(stream).ReadToEnd();
ret = string.Format("{0}...", readToEnd.Substring(0, 500));
}
s.Stop();
Publish(new PingerModel()
{
Time = DateTime.Now,
Url = url,
response = ret,
Status = response.StatusCode.ToString(),
StatusDescription = response.StatusDescription,
Duration = s.Elapsed,
ContentLength = response.ContentLength,
ContentType = response.ContentType
});
}
});
}
catch (Exception ex)
{
throw new JobExecutionException(ex);
}
}
示例4: Execute
public void Execute(IJobExecutionContext context)
{
var csvProcessor = context.Get("processor") as CsvProcessor;
RunJob(csvProcessor);
}