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 }