本文整理汇总了C#中IJobDetail类的典型用法代码示例。如果您正苦于以下问题:C# IJobDetail类的具体用法?C# IJobDetail怎么用?C# IJobDetail使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IJobDetail类属于命名空间,在下文中一共展示了IJobDetail类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: JobAdded
public void JobAdded(IJobDetail jobDetail)
{
foreach (ISchedulerListener listener in listeners)
{
listener.JobAdded(jobDetail);
}
}
开发者ID:jondhinkle,项目名称:Rock,代码行数:7,代码来源:BroadcastSchedulerListener.cs
示例2: AssignDataMap
void AssignDataMap(IJobDetail jobDetail, object createObject) {
if (jobDetail.JobDataMap!= null) {
var typeInfo = TypesInfo.FindTypeInfo(createObject.GetType());
var jobDataMap = ((JobDataMap) jobDetail.JobDataMap);
jobDataMap.Keys.OfType<string>().Each(AssignValue(createObject, jobDataMap, typeInfo));
}
}
开发者ID:aries544,项目名称:eXpand,代码行数:7,代码来源:_JobDataMapController.cs
示例3: ScheduleJob
public static void ScheduleJob(this IScheduler scheduler, IJobDetail jobDetail, string scheduleText, TimeZoneInfo timeZone)
{
TextToScheduleFactory factory = new TextToScheduleFactory();
var english = factory.CreateEnglishParser();
var results = english.Parse(scheduleText, timeZone);
results.ScheduleWithJob(scheduler, jobDetail);
}
开发者ID:amazing-andrew,项目名称:Quartz.TextToSchedule,代码行数:7,代码来源:TextToScheduleExtensions.cs
示例4: JsonJob
public JsonJob(IJobDetail jobDetail, IList<ITrigger> triggers)
{
JobType = jobDetail.JobType.FullName;
Description = jobDetail.Description;
Triggers = new List<JsonTrigger>(triggers.Count);
foreach (var trigger in triggers)
{
Triggers.Add(new JsonTrigger(trigger));
}
}
开发者ID:GoneFishern,项目名称:QuartzNetFeaturePack,代码行数:10,代码来源:JsonJob.cs
示例5: JobDetailDto
public JobDetailDto(IJobDetail jobDetail)
{
Durable = jobDetail.Durable;
ConcurrentExecutionDisallowed = jobDetail.ConcurrentExecutionDisallowed;
Description = jobDetail.Description;
JobType = jobDetail.JobType.AssemblyQualifiedNameWithoutVersion();
Name = jobDetail.Key.Name;
Group = jobDetail.Key.Group;
PersistJobDataAfterExecution = jobDetail.PersistJobDataAfterExecution;
RequestsRecovery = jobDetail.RequestsRecovery;
}
开发者ID:jvilalta,项目名称:quartznet,代码行数:11,代码来源:JobDetailDto.cs
示例6: CreateJob
private static void CreateJob()
{
// The job builder uses a fluent interface to
// make it easier to build and generate an
// IJobDetail object
_pollingJobDetail = JobBuilder.Create<PollWebsiteJob>()
.WithIdentity("StartPolling") // Here we can assign a friendly name to our job
.Build(); // And now we build the job detail
// Put options into data map
_pollingJobDetail.JobDataMap.Put("Url", _options.Url);
}
开发者ID:jorik041,项目名称:TheKangarooCourtBackgroundWorker,代码行数:12,代码来源:Program.cs
示例7: InsertExtendedTriggerProperties
public int InsertExtendedTriggerProperties(ConnectionAndTransactionHolder conn, IOperableTrigger trigger, string state, IJobDetail jobDetail)
{
ICronTrigger cronTrigger = (ICronTrigger) trigger;
using (IDbCommand cmd = DbAccessor.PrepareCommand(conn, AdoJobStoreUtil.ReplaceTablePrefix(StdAdoConstants.SqlInsertCronTrigger, TablePrefix, SchedNameLiteral)))
{
DbAccessor.AddCommandParameter(cmd, "triggerName", trigger.Key.Name);
DbAccessor.AddCommandParameter(cmd, "triggerGroup", trigger.Key.Group);
DbAccessor.AddCommandParameter(cmd, "triggerCronExpression", cronTrigger.CronExpressionString);
DbAccessor.AddCommandParameter(cmd, "triggerTimeZone", cronTrigger.TimeZone.Id);
return cmd.ExecuteNonQuery();
}
}
开发者ID:CharlieBP,项目名称:quartznet,代码行数:14,代码来源:CronTriggerPersistenceDelegate.cs
示例8: TriggerFiredBundle
/// <summary>
/// Initializes a new instance of the <see cref="TriggerFiredBundle"/> class.
/// </summary>
/// <param name="job">The job.</param>
/// <param name="trigger">The trigger.</param>
/// <param name="cal">The calendar.</param>
/// <param name="jobIsRecovering">if set to <c>true</c> [job is recovering].</param>
/// <param name="fireTimeUtc">The fire time.</param>
/// <param name="scheduledFireTimeUtc">The scheduled fire time.</param>
/// <param name="prevFireTimeUtc">The previous fire time.</param>
/// <param name="nextFireTimeUtc">The next fire time.</param>
public TriggerFiredBundle(IJobDetail job, IOperableTrigger trigger, ICalendar cal, bool jobIsRecovering,
DateTimeOffset? fireTimeUtc,
DateTimeOffset? scheduledFireTimeUtc,
DateTimeOffset? prevFireTimeUtc,
DateTimeOffset? nextFireTimeUtc)
{
this.job = job;
this.trigger = trigger;
this.cal = cal;
this.jobIsRecovering = jobIsRecovering;
this.fireTimeUtc = fireTimeUtc;
this.scheduledFireTimeUtc = scheduledFireTimeUtc;
this.prevFireTimeUtc = prevFireTimeUtc;
this.nextFireTimeUtc = nextFireTimeUtc;
}
开发者ID:vaskosound,项目名称:FantasyLeagueStats,代码行数:26,代码来源:TriggerFiredBundle.cs
示例9: InsertExtendedTriggerProperties
public int InsertExtendedTriggerProperties(ConnectionAndTransactionHolder conn, IOperableTrigger trigger, string state, IJobDetail jobDetail)
{
ISimpleTrigger simpleTrigger = (ISimpleTrigger) trigger;
using (IDbCommand cmd = commandAccessor.PrepareCommand(conn, AdoJobStoreUtil.ReplaceTablePrefix(StdAdoConstants.SqlInsertSimpleTrigger, tablePrefix, schedNameLiteral)))
{
commandAccessor.AddCommandParameter(cmd, "triggerName", trigger.Key.Name);
commandAccessor.AddCommandParameter(cmd, "triggerGroup", trigger.Key.Group);
commandAccessor.AddCommandParameter(cmd, "triggerRepeatCount", simpleTrigger.RepeatCount);
commandAccessor.AddCommandParameter(cmd, "triggerRepeatInterval", simpleTrigger.RepeatInterval.TotalMilliseconds);
commandAccessor.AddCommandParameter(cmd, "triggerTimesTriggered", simpleTrigger.TimesTriggered);
return cmd.ExecuteNonQuery();
}
}
开发者ID:neumik,项目名称:quartznet,代码行数:15,代码来源:SimpleTriggerPersistenceDelegate.cs
示例10: StoreJobAndTrigger
/// <summary>
/// Store the given <see cref="IJobDetail" /> and <see cref="ITrigger" />.
/// </summary>
/// <param name="newJob">The <see cref="IJobDetail" /> to be stored.</param>
/// <param name="newTrigger">The <see cref="ITrigger" /> to be stored.</param>
public virtual void StoreJobAndTrigger(IJobDetail newJob, IOperableTrigger newTrigger)
{
StoreJob(newJob, false);
StoreTrigger(newTrigger, false);
}
开发者ID:KevinVoell,项目名称:quartznet-mongodb,代码行数:10,代码来源:JobStore.cs
示例11: StoreJob
/// <summary>
/// Store the given <see cref="IJob" />.
/// </summary>
/// <param name="newJob">The <see cref="IJob" /> to be stored.</param>
/// <param name="replaceExisting">If <see langword="true" />, any <see cref="IJob" /> existing in the
/// <see cref="IJobStore" /> with the same name and group should be
/// over-written.</param>
public virtual void StoreJob(IJobDetail newJob, bool replaceExisting)
{
bool repl = false;
lock (lockObject)
{
if (this.CheckExists(newJob.Key))
{
if (!replaceExisting)
{
throw new ObjectAlreadyExistsException(newJob);
}
repl = true;
}
if (!repl)
{
// try insert new
this.Jobs.Insert(newJob.ToBsonDocument());
}
else
{
// force upsert
this.Jobs.Save(newJob.ToBsonDocument());
}
}
}
开发者ID:KevinVoell,项目名称:quartznet-mongodb,代码行数:36,代码来源:JobStore.cs
示例12: JobAdded
public void JobAdded(IJobDetail jobDetail)
{
}
开发者ID:CharlieBP,项目名称:quartznet,代码行数:3,代码来源:SchedulerListenerTest.cs
示例13: ScheduleJob
/// <summary>
/// Calls the equivalent method on the 'proxied' <see cref="QuartzScheduler" />.
/// </summary>
public virtual DateTimeOffset ScheduleJob(IJobDetail jobDetail, ITrigger trigger)
{
try
{
return GetRemoteScheduler().ScheduleJob(jobDetail, trigger);
}
catch (RemotingException re)
{
throw InvalidateHandleCreateException("Error communicating with remote scheduler.", re);
}
}
开发者ID:neumik,项目名称:quartznet,代码行数:14,代码来源:RemoteScheduler.cs
示例14: AddJob
/// <summary>
/// Calls the equivalent method on the 'proxied' <see cref="QuartzScheduler" />.
/// </summary>
public virtual void AddJob(IJobDetail jobDetail, bool replace)
{
try
{
GetRemoteScheduler().AddJob(jobDetail, replace);
}
catch (RemotingException re)
{
throw InvalidateHandleCreateException("Error communicating with remote scheduler.", re);
}
}
开发者ID:neumik,项目名称:quartznet,代码行数:14,代码来源:RemoteScheduler.cs
示例15: ObjectAlreadyExistsException
/// <summary> <para>
/// Create a <see cref="ObjectAlreadyExistsException" /> and auto-generate a
/// message using the name/group from the given <see cref="IJobDetail" />.
/// </para>
///
/// <para>
/// The message will read: <br />"Unable to store Job with name: '__' and
/// group: '__', because one already exists with this identification."
/// </para>
/// </summary>
public ObjectAlreadyExistsException(IJobDetail offendingJob)
: base($"Unable to store Job: '{offendingJob.Key}', because one already exists with this identification.")
{
}
开发者ID:jvilalta,项目名称:quartznet,代码行数:14,代码来源:ObjectAlreadyExistsException.cs
示例16: AddJob
public virtual void AddJob(IJobDetail jobDetail, bool replace, bool storeNonDurableWhileAwaitingScheduling)
{
ValidateState();
if (!storeNonDurableWhileAwaitingScheduling && !jobDetail.Durable)
{
throw new SchedulerException("Jobs added with no trigger must be durable.");
}
resources.JobStore.StoreJob(jobDetail, replace);
NotifySchedulerThread(null);
NotifySchedulerListenersJobAdded(jobDetail);
}
开发者ID:natenho,项目名称:quartznet,代码行数:13,代码来源:QuartzScheduler.cs
示例17: NotifyJobStoreJobVetoed
protected internal void NotifyJobStoreJobVetoed(IOperableTrigger trigger, IJobDetail detail, SchedulerInstruction instCode)
{
resources.JobStore.TriggeredJobComplete(trigger, detail, instCode);
}
开发者ID:natenho,项目名称:quartznet,代码行数:4,代码来源:QuartzScheduler.cs
示例18: ScheduleJob
/// <summary>
/// Add the <see cref="IJob" /> identified by the given
/// <see cref="IJobDetail" /> to the Scheduler, and
/// associate the given <see cref="ITrigger" /> with it.
/// <para>
/// If the given Trigger does not reference any <see cref="IJob" />, then it
/// will be set to reference the Job passed with it into this method.
/// </para>
/// </summary>
public virtual DateTimeOffset ScheduleJob(IJobDetail jobDetail, ITrigger trigger)
{
ValidateState();
if (jobDetail == null)
{
throw new SchedulerException("JobDetail cannot be null");
}
if (trigger == null)
{
throw new SchedulerException("Trigger cannot be null");
}
if (jobDetail.Key == null)
{
throw new SchedulerException("Job's key cannot be null");
}
if (jobDetail.JobType == null)
{
throw new SchedulerException("Job's class cannot be null");
}
IOperableTrigger trig = (IOperableTrigger) trigger;
if (trigger.JobKey == null)
{
trig.JobKey = jobDetail.Key;
}
else if (!trigger.JobKey.Equals(jobDetail.Key))
{
throw new SchedulerException("Trigger does not reference given job!");
}
trig.Validate();
ICalendar cal = null;
if (trigger.CalendarName != null)
{
cal = resources.JobStore.RetrieveCalendar(trigger.CalendarName);
if (cal == null)
{
throw new SchedulerException(string.Format(CultureInfo.InvariantCulture, "Calendar not found: {0}", trigger.CalendarName));
}
}
DateTimeOffset? ft = trig.ComputeFirstFireTimeUtc(cal);
if (!ft.HasValue)
{
var message = string.Format("Based on configured schedule, the given trigger '{0}' will never fire.", trigger.Key);
throw new SchedulerException(message);
}
resources.JobStore.StoreJobAndTrigger(jobDetail, trig);
NotifySchedulerListenersJobAdded(jobDetail);
NotifySchedulerThread(trigger.GetNextFireTimeUtc());
NotifySchedulerListenersScheduled(trigger);
return ft.Value;
}
开发者ID:natenho,项目名称:quartznet,代码行数:71,代码来源:QuartzScheduler.cs
示例19: TriggeredJobComplete
/// <summary>
/// Inform the <see cref="IJobStore" /> that the scheduler has completed the
/// firing of the given <see cref="ITrigger" /> (and the execution its
/// associated <see cref="IJob" />), and that the <see cref="JobDataMap" />
/// in the given <see cref="IJobDetail" /> should be updated if the <see cref="IJob" />
/// is stateful.
/// </summary>
public virtual void TriggeredJobComplete(IOperableTrigger trigger, IJobDetail jobDetail,
SchedulerInstruction triggerInstCode)
{
lock (lockObject)
{
this.ReleaseAcquiredTrigger(trigger);
// It's possible that the job is null if:
// 1- it was deleted during execution
// 2- RAMJobStore is being used only for volatile jobs / triggers
// from the JDBC job store
if (jobDetail.PersistJobDataAfterExecution)
{
this.Jobs.Update(
Query.EQ("_id", jobDetail.Key.ToBsonDocument()),
Update.Set("JobDataMap", jobDetail.JobDataMap.ToBsonDocument()));
}
if (jobDetail.ConcurrentExecutionDisallowed)
{
IList<Spi.IOperableTrigger> jobTriggers = this.GetTriggersForJob(jobDetail.Key);
IEnumerable<BsonDocument> triggerKeys = jobTriggers.Select(t => t.Key.ToBsonDocument());
this.Triggers.Update(
Query.And(
Query.In("_id", triggerKeys),
Query.EQ("State", "Blocked")),
Update.Set("State", "Waiting"));
this.Triggers.Update(
Query.And(
Query.In("_id", triggerKeys),
Query.EQ("State", "PausedAndBlocked")),
Update.Set("State", "Paused"));
signaler.SignalSchedulingChange(null);
}
// even if it was deleted, there may be cleanup to do
this.BlockedJobs.Remove(
Query.EQ("_id", jobDetail.Key.ToBsonDocument()));
// check for trigger deleted during execution...
if (triggerInstCode == SchedulerInstruction.DeleteTrigger)
{
log.Debug("Deleting trigger");
DateTimeOffset? d = trigger.GetNextFireTimeUtc();
if (!d.HasValue)
{
// double check for possible reschedule within job
// execution, which would cancel the need to delete...
d = trigger.GetNextFireTimeUtc();
if (!d.HasValue)
{
this.RemoveTrigger(trigger.Key);
}
else
{
log.Debug("Deleting cancelled - trigger still active");
}
}
else
{
this.RemoveTrigger(trigger.Key);
signaler.SignalSchedulingChange(null);
}
}
else if (triggerInstCode == SchedulerInstruction.SetTriggerComplete)
{
this.Triggers.Update(
Query.EQ("_id", trigger.Key.ToBsonDocument()),
Update.Set("State", "Complete"));
signaler.SignalSchedulingChange(null);
}
else if (triggerInstCode == SchedulerInstruction.SetTriggerError)
{
Log.Info(string.Format(CultureInfo.InvariantCulture, "Trigger {0} set to ERROR state.", trigger.Key));
this.Triggers.Update(
Query.EQ("_id", trigger.Key.ToBsonDocument()),
Update.Set("State", "Error"));
signaler.SignalSchedulingChange(null);
}
else if (triggerInstCode == SchedulerInstruction.SetAllJobTriggersError)
{
Log.Info(string.Format(CultureInfo.InvariantCulture, "All triggers of Job {0} set to ERROR state.", trigger.JobKey));
IList<Spi.IOperableTrigger> jobTriggers = this.GetTriggersForJob(jobDetail.Key);
IEnumerable<BsonDocument> triggerKeys = jobTriggers.Select(t => t.Key.ToBsonDocument());
this.Triggers.Update(
Query.In("_id", triggerKeys),
Update.Set("State", "Error"));
//.........这里部分代码省略.........
开发者ID:KevinVoell,项目名称:quartznet-mongodb,代码行数:101,代码来源:JobStore.cs
示例20: NotifySchedulerListenersJobAdded
public virtual void NotifySchedulerListenersJobAdded(IJobDetail jobDetail)
{
// notify all scheduler listeners
foreach (ISchedulerListener listener in BuildSchedulerListenerList())
{
try
{
listener.JobAdded(jobDetail);
}
catch (Exception e)
{
log.Error("Error while notifying SchedulerListener of JobAdded.", e);
}
}
}
开发者ID:natenho,项目名称:quartznet,代码行数:15,代码来源:QuartzScheduler.cs
注:本文中的IJobDetail类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论