示例#1
0
 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);
     }
 }
示例#2
0
 /// <summary>Stop the decommission monitor thread, waiting briefly for it to terminate.
 ///     </summary>
 internal virtual void Close()
 {
     executor.ShutdownNow();
     try
     {
         executor.AwaitTermination(3000, TimeUnit.Milliseconds);
     }
     catch (Exception)
     {
     }
 }
示例#3
0
 /// <exception cref="System.Exception"/>
 protected override void ServiceStop()
 {
     Log.Info("Shutting down the background thread.");
     scheduledExecutor.ShutdownNow();
     try
     {
         if (scheduledExecutor.AwaitTermination(10, TimeUnit.Seconds))
         {
             Log.Info("The background thread stopped.");
         }
         else
         {
             Log.Warn("Gave up waiting for the cleaner task to shutdown.");
         }
     }
     catch (Exception e)
     {
         Log.Warn("The cleaner service was interrupted while shutting down the task.", e);
     }
     RemoveGlobalCleanerPidFile();
     base.ServiceStop();
 }