コード例 #1
0
        private void OnGetLocalViewCompleted(IAsyncResult ar)
        {
            GroupQueuesDataProvider.GetLocalViewAsyncState getLocalViewAsyncState = (GroupQueuesDataProvider.GetLocalViewAsyncState)ar.AsyncState;
            DiagnosticsAggregationServiceClient            client = getLocalViewAsyncState.Client;
            ADObjectId        server       = getLocalViewAsyncState.Server;
            Stopwatch         stopwatch    = getLocalViewAsyncState.Stopwatch;
            LocalViewResponse response     = null;
            string            errorMessage = null;

            try
            {
                response = client.EndGetLocalView(ar);
            }
            catch (FaultException <DiagnosticsAggregationFault> faultException)
            {
                errorMessage = faultException.Detail.ToString();
            }
            catch (CommunicationException ex)
            {
                errorMessage = ex.Message;
            }
            catch (TimeoutException ex2)
            {
                errorMessage = ex2.Message;
            }
            finally
            {
                WcfUtils.DisposeWcfClientGracefully(client, false);
            }
            stopwatch.Stop();
            this.UpdateSnapshotForServer(server, getLocalViewAsyncState.RequestSessionId, stopwatch.Elapsed, response, errorMessage);
        }
コード例 #2
0
 private void RefreshCurrentGroupServerToQueuesMap()
 {
     ADNotificationAdapter.TryRunADOperation(new ADOperation(this.RefreshCurrentGroupServers), 2);
     lock (this)
     {
         ADObjectId[] array = new ADObjectId[this.currentGroupServerToQueuesMap.Keys.Count];
         this.currentGroupServerToQueuesMap.Keys.CopyTo(array, 0);
         foreach (ADObjectId adobjectId in array)
         {
             if (!this.currentGroupServers.Contains(adobjectId))
             {
                 this.currentGroupServerToQueuesMap.Remove(adobjectId);
             }
         }
     }
     foreach (ADObjectId adobjectId2 in this.currentGroupServers)
     {
         string uri = string.Format(CultureInfo.InvariantCulture, DiagnosticsAggregationHelper.DiagnosticsAggregationEndpointFormat, new object[]
         {
             adobjectId2.Name,
             DiagnosticsAggregationServicelet.TransportSettings.DiagnosticsAggregationServicePort
         });
         Exception ex = null;
         DiagnosticsAggregationServiceClient diagnosticsAggregationServiceClient = null;
         try
         {
             diagnosticsAggregationServiceClient = new DiagnosticsAggregationServiceClient(DiagnosticsAggregationServicelet.GetTcpBinding(), new EndpointAddress(uri));
         }
         catch (UriFormatException ex2)
         {
             ex = ex2;
         }
         LocalViewRequest localViewRequest = new LocalViewRequest(RequestType.Queues);
         localViewRequest.QueueLocalViewRequest = new QueueLocalViewRequest();
         Stopwatch stopwatch = new Stopwatch();
         stopwatch.Start();
         GroupQueuesDataProvider.GetLocalViewAsyncState asyncState = new GroupQueuesDataProvider.GetLocalViewAsyncState
         {
             Client           = diagnosticsAggregationServiceClient,
             Server           = adobjectId2,
             Stopwatch        = stopwatch,
             RequestSessionId = localViewRequest.ClientInformation.SessionId
         };
         try
         {
             if (diagnosticsAggregationServiceClient != null)
             {
                 diagnosticsAggregationServiceClient.BeginGetLocalView(localViewRequest, new AsyncCallback(this.OnGetLocalViewCompleted), asyncState);
             }
         }
         catch (EndpointNotFoundException ex3)
         {
             ex = ex3;
         }
         catch (InsufficientMemoryException ex4)
         {
             ex = ex4;
         }
         catch (CommunicationException ex5)
         {
             ex = ex5;
         }
         catch (TimeoutException ex6)
         {
             ex = ex6;
         }
         if (ex != null)
         {
             WcfUtils.DisposeWcfClientGracefully(diagnosticsAggregationServiceClient, false);
             stopwatch.Stop();
             this.UpdateSnapshotForServer(adobjectId2, localViewRequest.ClientInformation.SessionId, stopwatch.Elapsed, null, ex.Message);
             if (ex is InsufficientMemoryException)
             {
                 lock (this)
                 {
                     this.log.Log(DiagnosticsAggregationEvent.OutOfResources, "running out of ephemeral ports, will stop making further web service requests", new object[0]);
                     break;
                 }
             }
         }
     }
 }