public override void Destroy() { try { long limit = Time.Now() + 30 * 1000; scheduler.ShutdownNow(); while (!scheduler.AwaitTermination(1000, TimeUnit.Milliseconds)) { Log.Debug("Waiting for scheduler to shutdown"); if (Time.Now() > limit) { Log.Warn("Gave up waiting for scheduler to shutdown"); break; } } if (scheduler.IsTerminated()) { Log.Debug("Scheduler shutdown"); } } catch (Exception ex) { Log.Warn(ex.Message, ex); } }