Testen auf IInterruptableJob

Ich habe folgenden Code:

    private static void InterruptAJob(JobKey foundJobKey, IScheduler sched)
    {
        if (null != foundJobKey)
        {
            sched.Interrupt(foundJobKey);
        }
    }

Ich erhalte diese Ausnahme (ich erwarte dies):

"Job 'groupName001.testJobDetailImpl_0' kann nicht unterbrochen werden, da Quartz.IInterruptableJob nicht implementiert wird"

Gibt es eine Möglichkeit, mit dem "JobKey" auf IInterruptableJob zu testen?

........

BEARBEITEN (ANHANG)

/// <summary>
/// Request the interruption, within this Scheduler instance, of all
/// currently executing instances of the identified <see cref="IJob" />, which
/// must be an implementor of the <see cref="IInterruptableJob"/> interface.
/// </summary>
/// <remarks>
/// <para>
/// If more than one instance of the identified job is currently executing,
/// the <see cref="IInterruptableJob.Interrupt"/> method will be called on
/// each instance. However, there is a limitation that in the case that
/// <see cref="Interrupt(JobKey)"/> on one instances throws an exception, all
/// remaining instances (that have not yet been interrupted) will not have
/// their <see cref="Interrupt(JobKey)"/> method called.
/// </para>
/// <para>
/// If you wish to interrupt a specific instance of a job (when more than
/// one is executing) you can do so by calling
/// <see cref="GetCurrentlyExecutingJobs"/> to obtain a handle
/// to the job instance, and then invoke <see cref="Interrupt(JobKey)"/> on it
/// yourself.
/// </para>
/// <para>
/// This method is not cluster aware. That is, it will only interrupt
/// instances of the identified InterruptableJob currently executing in this
/// Scheduler instance, not across the entire cluster.
/// </para>
/// </remarks>
/// <returns>true is at least one instance of the identified job was found and interrupted.</returns>
/// <throws> UnableToInterruptJobException if the job does not implement </throws>
/// <seealso cref="IInterruptableJob"/>
/// <seealso cref="GetCurrentlyExecutingJobs"/>
public virtual bool Interrupt(JobKey jobKey)
{

Die Kommentare besagen, dass Sie IScheduler.GetCurrentlyExecutingJobs () verwenden. Das gibt mir eine Sammlung von JobKey's.

Ich vermute, eine andere Möglichkeit, die Frage zu stellen, ist ... wie kann ich diese Funktionalität unten erhalten?

IScheduler.GetCurrentlyExecutingIInterruptableJobs

Antworten auf die Frage(0)

Ihre Antwort auf die Frage