45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System.Diagnostics;
|
|
using System.Threading;
|
|
using GerstITS.Data;
|
|
using GerstITS.Examples.Jobs.SayHelloWorld.Configurations;
|
|
using GerstITS.Job;
|
|
using GerstITS.System.Environment;
|
|
using Quartz;
|
|
|
|
namespace GerstITS.Examples.Jobs.SayHelloWorld.Jobs
|
|
{
|
|
[DisallowConcurrentExecution]
|
|
public class SayHelloWorldJob : JobBase
|
|
{
|
|
#region Fields
|
|
|
|
private readonly SayHelloWorldJobConfiguration _configuration;
|
|
private readonly Stopwatch _stopWatch;
|
|
|
|
#endregion
|
|
|
|
#region Cosntructors
|
|
|
|
public SayHelloWorldJob(SayHelloWorldJobConfiguration configuration,
|
|
ISystemClock systemClock)
|
|
{
|
|
_configuration = configuration;
|
|
_stopWatch = new Stopwatch();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
protected override void Execute()
|
|
{
|
|
_stopWatch.Restart();
|
|
Thread.Sleep(4000);
|
|
|
|
_stopWatch.Stop();
|
|
Debug.WriteLine($"---> Say hello to world from {_configuration.Name}, Duration: {_stopWatch.ElapsedMilliseconds / 1000}s");
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |