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 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); }
public void UpdateSuccess(LocalViewResponse response) { this.queues = response.QueueLocalViewResponse.LocalQueues; this.timeStampOfQueues = new DateTime?(response.QueueLocalViewResponse.Timestamp); this.timeOfLastSuccess = response.ServerSnapshotStatus.TimeOfLastSuccess; this.timeOfLastFailure = response.ServerSnapshotStatus.TimeOfLastFailure; this.lastError = response.ServerSnapshotStatus.LastError; }
private void UpdateSnapshotForServer(ADObjectId server, uint requestSessionId, TimeSpan operationDuration, LocalViewResponse response, string errorMessage) { lock (this) { ServerQueuesSnapshot serverQueuesSnapshot = null; bool flag2 = this.currentGroupServerToQueuesMap.TryGetValue(server, out serverQueuesSnapshot); if (flag2) { serverQueuesSnapshot = serverQueuesSnapshot.Clone(); } else { serverQueuesSnapshot = new ServerQueuesSnapshot(server); } if (response == null) { serverQueuesSnapshot.UpdateFailure(errorMessage); this.log.LogOperationToServer(DiagnosticsAggregationEvent.LocalViewRequestSentFailed, requestSessionId, server.Name, new TimeSpan?(operationDuration), errorMessage); } else { serverQueuesSnapshot.UpdateSuccess(response); this.log.LogOperationToServer(DiagnosticsAggregationEvent.LocalViewResponseReceived, requestSessionId, server.Name, new TimeSpan?(operationDuration), ""); } this.currentGroupServerToQueuesMap[server] = serverQueuesSnapshot; } }