Files
Examples/GerstITS.Examples.Jobs.SayHelloWorld/Jobs/SayHelloWorldWithDefaultNameUsageJob.cs
2022-12-22 08:32:15 +01:00

41 lines
1012 B
C#

using System.Diagnostics;
using System.Threading;
using GerstITS.Examples.Jobs.SayHelloWorld.Configurations;
using GerstITS.Job;
using Quartz;
namespace GerstITS.Examples.Jobs.SayHelloWorld.Jobs;
[DisallowConcurrentExecution]
public class SayHelloWorldWithDefaultNameUsageJob : JobBase
{
#region Fields
private readonly SayHelloWorldWithDefaultNameUsageJobConfiguration _configuration;
private readonly Stopwatch _stopWatch;
#endregion
#region Cosntructors
public SayHelloWorldWithDefaultNameUsageJob(SayHelloWorldWithDefaultNameUsageJobConfiguration configuration)
{
_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
}