예제 #1
0
 private async Task ShutdownQueue()
 {
     if (_jobServerQueue != null)
     {
         try
         {
             Trace.Info("Shutting down the job server queue.");
             await _jobServerQueue.ShutdownAsync();
         }
         catch (Exception ex)
         {
             Trace.Error($"Caught exception from {nameof(JobServerQueue)}.{nameof(_jobServerQueue.ShutdownAsync)}: {ex}");
         }
         finally
         {
             _jobServerQueue = null; // Prevent multiple attempts.
         }
     }
 }
예제 #2
0
 private async Task ShutdownQueue(bool throwOnFailure)
 {
     if (_jobServerQueue != null)
     {
         try
         {
             Trace.Info("Shutting down the job server queue.");
             await _jobServerQueue.ShutdownAsync();
         }
         catch (AggregateException ex)
         {
             ExceptionsUtil.HandleAggregateException((AggregateException)ex, Trace.Error);
         }
         catch (Exception ex) when(!throwOnFailure)
         {
             Trace.Error($"Caught exception from {nameof(JobServerQueue)}.{nameof(_jobServerQueue.ShutdownAsync)}");
             Trace.Error(ex);
         }
         finally
         {
             _jobServerQueue = null; // Prevent multiple attempts.
         }
     }
 }