2015-02-04 15:12:37 +11:00
|
|
|
namespace Umbraco.Web.Scheduling
|
|
|
|
|
{
|
2015-02-06 16:10:34 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Provides options to the <see cref="BackgroundTaskRunner{T}"/> class.
|
|
|
|
|
/// </summary>
|
2015-02-04 15:12:37 +11:00
|
|
|
internal class BackgroundTaskRunnerOptions
|
|
|
|
|
{
|
|
|
|
|
//TODO: Could add options for using a stack vs queue if required
|
|
|
|
|
|
2015-02-06 16:10:34 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="BackgroundTaskRunnerOptions"/> class.
|
|
|
|
|
/// </summary>
|
2015-02-04 15:12:37 +11:00
|
|
|
public BackgroundTaskRunnerOptions()
|
|
|
|
|
{
|
2015-02-06 16:10:34 +01:00
|
|
|
LongRunning = false;
|
|
|
|
|
KeepAlive = false;
|
|
|
|
|
AutoStart = false;
|
2015-07-10 15:52:58 +02:00
|
|
|
PreserveRunningTask = false;
|
|
|
|
|
Hosted = true;
|
2015-02-04 15:12:37 +11:00
|
|
|
}
|
|
|
|
|
|
2015-02-06 16:10:34 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value indicating whether the running task should be a long-running,
|
|
|
|
|
/// coarse grained operation.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool LongRunning { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value indicating whether the running task should block and wait
|
|
|
|
|
/// on the queue, or end, when the queue is empty.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool KeepAlive { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value indicating whether the running task should start immediately
|
|
|
|
|
/// or only once a task has been added to the queue.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool AutoStart { get; set; }
|
2015-02-04 15:12:37 +11:00
|
|
|
|
|
|
|
|
/// <summary>
|
2015-07-10 15:52:58 +02:00
|
|
|
/// Gets or sets a value indicating whether the running task should be preserved
|
2015-02-06 16:10:34 +01:00
|
|
|
/// once completed, or reset to null. For unit tests.
|
2015-02-04 15:12:37 +11:00
|
|
|
/// </summary>
|
2015-02-06 16:10:34 +01:00
|
|
|
public bool PreserveRunningTask { get; set; }
|
2015-07-10 15:52:58 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value indicating whether the runner should register with (and be
|
|
|
|
|
/// stopped by) the hosting. Otherwise, something else should take care of stopping
|
|
|
|
|
/// the runner. True by default.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool Hosted { get; set; }
|
2015-02-04 15:12:37 +11:00
|
|
|
}
|
|
|
|
|
}
|