public LocalViewResponse GetLocalView(LocalViewRequest request) { LocalViewResponse response = null; this.ServiceRequest(delegate { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); ExTraceGlobals.DiagnosticsAggregationTracer.TraceFunction <string, string, string>(0L, "GetLocalView called. ClientMachineName={0}; ClientProcessName={1}; ClientProcessId={2}", (request.ClientInformation == null) ? string.Empty : request.ClientInformation.ClientMachineName, (request.ClientInformation == null) ? string.Empty : request.ClientInformation.ClientProcessName, (request.ClientInformation == null) ? string.Empty : request.ClientInformation.ClientProcessId.ToString()); this.log.LogOperationFromClient(DiagnosticsAggregationEvent.LocalViewRequestReceived, request.ClientInformation, null, ""); DiagnosticsAggregationServiceImpl.VerifyParameterIsNotNull(request, "request"); DiagnosticsAggregationServiceImpl.VerifyParameterIsNotNullOrEmpty(request.RequestType, "request.RequestType"); RequestType requestType; bool flag = Enum.TryParse <RequestType>(request.RequestType, out requestType); if (!flag || requestType != RequestType.Queues) { throw DiagnosticsAggregationServiceImpl.NewUnsupportedParameterFault(request.RequestType, "request.RequestType"); } ServerQueuesSnapshot localServerQueues = this.localQueuesDataProvider.GetLocalServerQueues(); if (localServerQueues.IsEmpty()) { throw DiagnosticsAggregationServiceImpl.NewFault(ErrorCode.LocalQueueDataNotAvailable, localServerQueues.LastError); } string message; if (this.LocalQueueDataTooOld(localServerQueues.TimeStampOfQueues, out message)) { throw DiagnosticsAggregationServiceImpl.NewFault(ErrorCode.LocalQueueDataTooOld, message); } response = new LocalViewResponse(localServerQueues.GetServerSnapshotStatus()); response.QueueLocalViewResponse = new QueueLocalViewResponse(new List <LocalQueueInfo>(localServerQueues.Queues), localServerQueues.TimeStampOfQueues); stopwatch.Stop(); this.log.LogOperationFromClient(DiagnosticsAggregationEvent.LocalViewResponseSent, request.ClientInformation, new TimeSpan?(stopwatch.Elapsed), ""); }, "GetLocalView", request.ClientInformation); return(response); }
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; } } } } }