2014-06-24 44 views

回答

0

是的,這是由CronTrigger支持的。 CronTriggerImpl有一個構造函數,允許你這樣做:

/// <summary> 
/// Create a <see cref="CronTriggerImpl" /> with fire time dictated by the 
/// <param name="cronExpression" /> resolved with respect to the specified 
/// <param name="timeZone" /> occurring from the <see cref="startTimeUtc" /> until 
/// the given <paran name="endTimeUtc" />. 
/// </summary> 
/// <param name="name">The name of the <see cref="ITrigger" /></param> 
/// <param name="group">The group of the <see cref="ITrigger" /></param> 
/// <param name="jobName">name of the <see cref="IJobDetail" /> executed on firetime</param> 
/// <param name="jobGroup">Group of the <see cref="IJobDetail" /> executed on firetime</param> 
/// <param name="startTimeUtc">A <see cref="DateTimeOffset" /> set to the earliest time for the <see cref="ITrigger" /> to start firing.</param> 
/// <param name="endTime">A <see cref="DateTimeOffset" /> set to the time for the <see cref="ITrigger" /> to quit repeat firing.</param> 
public CronTriggerImpl(string name, string group, string jobName, 
    string jobGroup, DateTimeOffset startTimeUtc, 
    DateTimeOffset? endTime, 
    string cronExpression, 
    TimeZoneInfo timeZone) : base(name, group, jobName, jobGroup) 
{ 
    CronExpressionString = cronExpression; 

    if (startTimeUtc == DateTimeOffset.MinValue) 
    { 
     startTimeUtc = SystemTime.UtcNow(); 
    } 
    StartTimeUtc = startTimeUtc; 

    if (endTime.HasValue) 
    { 
     EndTimeUtc = endTime; 
    } 
    if (timeZone == null) 
    { 
     timeZone = TimeZoneInfo.Local; 
    } 
    else 
    { 
     TimeZone = timeZone; 
    } 
} 
相關問題