本文整理汇总了C#中Quartz.Spi.TriggerFiredBundle类的典型用法代码示例。如果您正苦于以下问题:C# TriggerFiredBundle类的具体用法?C# TriggerFiredBundle怎么用?C# TriggerFiredBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TriggerFiredBundle类属于Quartz.Spi命名空间,在下文中一共展示了TriggerFiredBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewJob
/// <summary>
/// Called by the scheduler at the time of the trigger firing, in order to
/// produce a <see cref="T:Quartz.IJob"/> instance on which to call Execute.
///
/// </summary>
///
/// <remarks>
/// It should be extremely rare for this method to throw an exception -
/// basically only the the case where there is no way at all to instantiate
/// and prepare the Job for execution. When the exception is thrown, the
/// Scheduler will move all triggers associated with the Job into the
/// <see cref="F:Quartz.TriggerState.Error"/> state, which will require human
/// intervention (e.g. an application restart after fixing whatever
/// configuration problem led to the issue wih instantiating the Job.
///
/// </remarks>
/// <param name="bundle">The TriggerFiredBundle from which the <see cref="T:Quartz.IJobDetail"/>
/// and other info relating to the trigger firing can be obtained.
/// </param><param name="scheduler">a handle to the scheduler that is about to execute the job</param><throws>SchedulerException if there is a problem instantiating the Job. </throws>
/// <returns>
/// the newly instantiated Job
///
/// </returns>
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
var jobType = bundle.JobDetail.JobType.FullName;
TenantId tenantId = null;
if (bundle.JobDetail.JobDataMap.ContainsKey(JobKeys.TenantId))
{
tenantId = new TenantId(
bundle.JobDetail.JobDataMap.GetString(JobKeys.TenantId)
);
Logger.DebugFormat("new job {0} on tenant {1}", jobType, tenantId );
}
else
{
if (typeof (ITenantJob).IsAssignableFrom(bundle.JobDetail.JobType))
{
string message = String.Format("Job {0}: missing tenantId", jobType);
Logger.Error(message);
throw new Exception(message);
}
Logger.DebugFormat("new job {0} without tenant", jobType);
}
var kernel = SelectKernel(tenantId);
var job = this.ResolveByJobName ?
(IJob)kernel.Resolve(bundle.JobDetail.Key.ToString(), typeof(IJob)) :
(IJob)kernel.Resolve(bundle.JobDetail.JobType);
if (job is ITenantJob)
{
(job as ITenantJob).TenantId = new TenantId(tenantId);
}
return job;
}
示例2: NewJob
public IJob NewJob(TriggerFiredBundle bundle)
{
Type jobType = bundle.JobDetail.JobType;
var job = ObjectFactory.GetInstance(jobType) as IJob;
ObjectFactory.BuildUp(job);
return job;
}
示例3: NewJob
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
var jobDetail = bundle.JobDetail;
var jobType = jobDetail.JobType;
try
{
if (Log.IsDebugEnabled)
{
Log.Debug(string.Format("Producing instance of Job '{0}', class={1}",
new object[] { jobDetail.Key, jobType.FullName }));
}
var disallowConcurent =
jobType.GetCustomAttributes(typeof(DisallowConcurrentExecutionAttribute), true).Length == 1;
return typeof(IInterruptableJob).IsAssignableFrom(jobType)
? disallowConcurent
? new InterruptableDisallowConcurrentExecutionJobWrapper(bundle, _container)
: new InterruptableJobWrapper(bundle, _container)
: disallowConcurent
? new DisallowConcurrentExecutionJobWrapper(bundle, _container)
: new JobWrapper(bundle, _container);
}
catch (Exception ex)
{
throw new SchedulerException(
string.Format("Problem instantiating class '{0}'", new object[] { jobDetail.JobType.FullName }), ex);
}
}
示例4: CreateJobInstance
/// <summary>
/// Create the job instance, populating it with property values taken
/// from the scheduler context, job data map and trigger data map.
/// </summary>
protected override object CreateJobInstance(TriggerFiredBundle bundle)
{
ObjectWrapper ow = new ObjectWrapper(bundle.JobDetail.JobType);
if (IsEligibleForPropertyPopulation(ow.WrappedInstance))
{
MutablePropertyValues pvs = new MutablePropertyValues();
if (schedulerContext != null)
{
pvs.AddAll(schedulerContext);
}
pvs.AddAll(bundle.JobDetail.JobDataMap);
pvs.AddAll(bundle.Trigger.JobDataMap);
if (ignoredUnknownProperties != null)
{
for (int i = 0; i < ignoredUnknownProperties.Length; i++)
{
string propName = ignoredUnknownProperties[i];
if (pvs.Contains(propName))
{
pvs.Remove(propName);
}
}
ow.SetPropertyValues(pvs);
}
else
{
ow.SetPropertyValues(pvs, true);
}
}
return ow.WrappedInstance;
}
示例5: NewJob
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
var jobDetail = bundle.JobDetail;
var jobType = jobDetail.JobType;
try
{
if (Log.IsDebugEnabled)
{
Log.Debug(string.Format(
CultureInfo.InvariantCulture,
"Producing instance of Job '{0}', class={1}", new object[] { jobDetail.Key, jobType.FullName }));
}
return typeof(IInterruptableJob).IsAssignableFrom(jobType)
? new InterruptableJobWrapper(bundle, container)
: new JobWrapper(bundle, container);
}
catch (Exception ex)
{
throw new SchedulerException(string.Format(
CultureInfo.InvariantCulture,
"Problem instantiating class '{0}'", new object[] { jobDetail.JobType.FullName }), ex);
}
}
示例6: Initialize
/// <summary>
/// Initializes the job execution context with given scheduler and bundle.
/// </summary>
/// <param name="sched">The scheduler.</param>
/// <param name="firedBundle">The bundle offired triggers.</param>
public virtual void Initialize(QuartzScheduler sched, TriggerFiredBundle firedBundle)
{
qs = sched;
IJob job;
JobDetail jobDetail = firedBundle.JobDetail;
try
{
job = sched.JobFactory.NewJob(firedBundle);
}
catch (SchedulerException se)
{
sched.NotifySchedulerListenersError(string.Format(CultureInfo.InvariantCulture, "An error occured instantiating job to be executed. job= '{0}'", jobDetail.FullName), se);
throw;
}
catch (Exception e)
{
SchedulerException se = new SchedulerException(string.Format(CultureInfo.InvariantCulture, "Problem instantiating type '{0}'", jobDetail.JobType.FullName), e);
sched.NotifySchedulerListenersError(string.Format(CultureInfo.InvariantCulture, "An error occured instantiating job to be executed. job= '{0}'", jobDetail.FullName), se);
throw se;
}
jec = new JobExecutionContext(scheduler, firedBundle, job);
}
示例7: NewJob
/// <summary>
/// Creates a new job resolved from the IoC container.
/// </summary>
/// <param name="bundle">Trigger fired bundle instance.</param>
/// <param name="scheduler">Scheduler instance.</param>
/// <returns>Returns a new job resolved from the IoC container.</returns>
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
if (bundle == null)
throw new ArgumentNullException("bundle");
return (IJob)this._container.Resolve(bundle.JobDetail.JobType);
}
示例8: NewJob
/// <summary>
/// Called by the scheduler at the time of the trigger firing, in order to produce
/// a Quartz.IJob instance on which to call Execute
/// </summary>
/// <param name="bundle">The TriggerFiredBundle from which the Quartz.IJobDetail and other info relating to the trigger firing can be obtained.</param>
/// <param name="scheduler">A handle to the scheduler that is about to execute the job</param>
/// <returns>The new intance of IJob</returns>
public IJob NewJob(
TriggerFiredBundle bundle,
IScheduler scheduler)
{
return (IJob)_container
.GetInstance(bundle.JobDetail.JobType);
}
示例9: NewJob
//-----------------------------------------------------------------------------------------------------------------------------------------------------
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
var jobAdapter = (IJob)_components.Resolve(
bundle.JobDetail.JobType,
new TypedParameter(typeof(IJobDetail), bundle.JobDetail));
return jobAdapter;
}
示例10: NewJob
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
if (bundle == null) throw new ArgumentNullException("bundle");
if (scheduler == null) throw new ArgumentNullException("scheduler");
var job = (IJob)IocManager.Instance.Resolve(bundle.JobDetail.JobType);
return job;
}
示例11: NewJob
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
var type = bundle.JobDetail.JobType;
_logger.Info("Job {0} was created", type.FullName);
return _kernel.Get(type) as IJob;
}
示例12: NewJob
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
var jobType = typeof(AutofacOwnedJob<>).MakeGenericType(new[] { bundle.JobDetail.JobType });
var job = this.container.Resolve(jobType);
return (IJob)job;
}
示例13: NewJob
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
IJobDetail jobDetail = bundle.JobDetail;
if (jobDetail == null)
throw new SchedulerException("JobDetail was null");
Type type = jobDetail.JobType;
return _typeFactories[type].NewJob(bundle, scheduler);
}
示例14: NewJob
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
var jobDetail = bundle.JobDetail;
if (jobDetail == null)
throw new SchedulerException("JobDetail was null");
var type = jobDetail.JobType;
return _typeFactories.GetOrAdd(type, CreateJobFactory)
.NewJob(bundle, scheduler);
}
示例15: NewJob
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
try
{
return (IJob)_lifetimeScope.Resolve(bundle.JobDetail.JobType);
}
catch (Exception e)
{
throw new SchedulerException("Problem instantiating class: " + e.Message, e);
}
}