Exemplo n.º 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);
     }
 }
Exemplo n.º 2
0
 public virtual void StopReloader()
 {
     lock (this)
     {
         if (executorService != null)
         {
             executorService.ShutdownNow();
             executorService = null;
         }
     }
 }
Exemplo n.º 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)
     {
     }
 }
Exemplo n.º 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();
     }
 }
Exemplo n.º 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();
 }
Exemplo n.º 6
0
 public virtual void Shutdown()
 {
     executor.ShutdownNow();
 }