示例#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
 public virtual void StopReloader()
 {
     lock (this)
     {
         if (executorService != null)
         {
             executorService.ShutdownNow();
             executorService = null;
         }
     }
 }
示例#3
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)
     {
     }
 }
示例#4
0
 public static void SyncLogsShutdown(ScheduledExecutorService scheduler)
 {
     lock (typeof(TaskLog))
     {
         // flush standard streams
         //
         System.Console.Out.Flush();
         System.Console.Error.Flush();
         if (scheduler != null)
         {
             scheduler.ShutdownNow();
         }
         // flush & close all appenders
         LogManager.Shutdown();
     }
 }
示例#5
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();
 }
示例#6
0
 public virtual void Shutdown()
 {
     executor.ShutdownNow();
 }