public virtual void BeginExit(Action onFailed) { try { this.OnFailed = onFailed; BrokerTracing.TraceVerbose("[SerivceHostController].BeginExit: construct the client. Binding {0}, Endpoint {1}", this.binding, this.controllerEndpoint); HpcServiceHostClient serviceHostClient = new HpcServiceHostClient(this.binding, this.controllerEndpoint, BrokerIdentity.IsHAMode); this.controllerClient = serviceHostClient; BrokerTracing.TraceVerbose("[SerivceHostController].BeginExit: BeginExit. Binding {0}, Endpoint {1}", this.binding, this.controllerEndpoint); serviceHostClient.BeginExit(this.EndExit, serviceHostClient); BrokerTracing.TraceVerbose("[SerivceHostController].BeginExit: Called. Binding {0}, Endpoint {1}", this.binding, this.controllerEndpoint); } catch (Exception ex) { BrokerTracing.TraceWarning("[SerivceHostController].BeginExit: Exception : {0}", ex); this.OnFailed(); // If BeginExit fails, dont retry any further. The task likely terminated already if (this.controllerClient != null) { Utility.AsyncCloseICommunicationObject(this.controllerClient); } } }
/// <summary> /// Refresh the client. /// For burst, cleanup the connection pool if the exception occurs /// between broker and proxy. /// </summary> /// <param name="clientIndex">client index</param> /// <param name="exceptionIndirect"> /// is the exception from the connection between broker and proxy, /// or between proxy and host /// </param> /// <param name="messageId">message Id</param> /// <returns>should increase the retry count or not</returns> public override async Task <bool> RefreshClientAsync(int clientIndex, bool exceptionIndirect, Guid messageId) { BrokerTracing.TraceWarning( BrokerTracing.GenerateTraceString( "AzureNettcpRequestSender", "RefreshClientAsync", this.Dispatcher.TaskId, clientIndex, this.Client.ToString(), messageId, string.Format("exceptionIndirect = {0}", exceptionIndirect))); bool increaseRetryCount = false; if (exceptionIndirect) { this.Dispatcher.PassBindingFlags[clientIndex] = true; increaseRetryCount = true; } else { increaseRetryCount = this.Dispatcher.CleanupClient(this.Client); await this.CreateClientAsync(false, clientIndex).ConfigureAwait(false); } return(increaseRetryCount); }
/// <summary> /// reset the current response callback, after this method call, /// the registered RegisterResponseCallback will get the responses from the beginning. /// </summary> public void ResetResponsesCallback() { if (this.isClosedField) { BrokerTracing.TraceWarning("[MemoryPersist] .ResetResponsesCallback: the queue is closed."); return; } lock (this.lockResponseQueueField) { // merge responseQueueField and filteredOutResponseQueueFiled Queue <BrokerQueueItem> fromQueue = this.filteredOutResponseQueueField; Queue <BrokerQueueItem> toQueue = this.responseQueueField; if (this.responseQueueField.Count < this.filteredOutResponseQueueField.Count) { fromQueue = this.responseQueueField; toQueue = this.filteredOutResponseQueueField; } while (fromQueue.Count > 0) { toQueue.Enqueue(fromQueue.Dequeue()); } if (this.filteredOutResponseQueueField.Count > 0) { Queue <BrokerQueueItem> tempQueue = this.responseQueueField; this.responseQueueField = this.filteredOutResponseQueueField; this.filteredOutResponseQueueField = tempQueue; } } }
/// <summary> /// Get a response from the storage /// </summary> /// <param name="callback">the response callback, the async result should be the BrokerQueueItem</param> /// <param name="callbackState">the state object for the callback</param> public void GetResponseAsync(PersistCallback callback, object callbackState) { if (this.isClosedField) { BrokerTracing.TraceWarning("[MemoryPersist] .GetResponseAsync: the queue is closed."); return; } BrokerQueueItem responseItem = null; try { lock (this.lockResponseQueueField) { responseItem = this.responseQueueField.Dequeue(); } } catch (InvalidOperationException) { BrokerTracing.TraceError("[MemoryPersist] .GetResponseAsync: no response available. sessionId = {0}, clientId = {1}", this.sessionIdField, this.clientIdField); } if (callback == null) { return; } ThreadPool.QueueUserWorkItem(this.GetOperationComplete, new GetCallbackContext(callback, callbackState, responseItem)); }
/// <summary> /// helper function to deserialize the object from the serialization info. /// </summary> /// <param name="serializationEntry">the serialization entry.</param> /// <returns>the deserialized object.</returns> private static object DeserializeObject(SerializationEntry serializationEntry) { object deserializedObject = null; byte[] deserializeData = null; try { deserializeData = (byte[])serializationEntry.Value; } catch (Exception e) { BrokerTracing.TraceWarning("[PersistMessage] .DeserializeObject: the serialization entry.Value data type is, {0}, can not cast to byte[], the exception: {1}", serializationEntry.Value.GetType(), e); } if (deserializeData != null) { using (MemoryStream memoryStream = new MemoryStream(deserializeData)) { IFormatter formatter = (IFormatter) new BinaryFormatter(); deserializedObject = formatter.Deserialize(memoryStream); } } return(deserializedObject); }
public Message ReceiveRequest() { BrokerTracing.TraceInfo("[AzureQueueProxy] ReceiveRequest is called"); Message request = null; try { while (!this.requestMessageQueue.TryTake(out request, RequestWaitIntervalMs)) { BrokerTracing.TraceInfo("[AzureQueueProxy] No message in the request message queue. Block wait."); } } catch (ObjectDisposedException) { BrokerTracing.TraceWarning("[AzureQueueProxy] requestMessageQueue is disposed."); return(null); } // while (!requestMessageQueue.TryDequeue(out request)) // { // BrokerTracing.TraceInfo("[AzureQueueProxy] No message in the request message queue. Sleep wait."); // Thread.Sleep(RequestWaitIntervalMs); // } BrokerTracing.TraceInfo("[AzureQueueProxy] Request is dequeued {0}", request.Version.ToString()); return(request); }
private void EndExit(IAsyncResult result) { var client = (ProxyServiceControlClient)result.AsyncState; bool needRetry = false; try { BrokerTracing.TraceVerbose("[AzureServiceHostController].EndExit: Try to call EndExit method, https = {0}", this.https); client.EndExit(result); } catch (Exception e) { BrokerTracing.TraceWarning("[AzureServiceHostController].EndExit: Exception thrown while exiting service host: {0}", e); if (++this.retryCount <= MaxExitServiceRetryCount) { needRetry = true; } else { this.OnFailed(); } } finally { Utility.AsyncCloseICommunicationObject(client); this.controllerClient = null; } if (needRetry) { this.BeginExit(this.OnFailed); } }
/// <summary> /// Create a IService instance with specified index. /// </summary> /// <param name="getNextRequest"> /// trigger the client to retrieve next request /// </param> /// <param name="clientIndex"> /// index of the client /// </param> public virtual async Task CreateClientAsync(bool getNextRequest, int clientIndex) { if (this.IServiceClient != null) { BrokerTracing.TraceWarning( BrokerTracing.GenerateTraceString( "RequestSender", "CreateClientAsync", this.TaskId, clientIndex, this.IServiceClient.ToString(), string.Empty, "Closed former client proxy.")); this.CloseClient(); } try { await this.CreateClientAsync().ConfigureAwait(false); BrokerTracing.TraceVerbose( BrokerTracing.GenerateTraceString( "RequestSender", "CreateClientAsync", this.TaskId, clientIndex, this.IServiceClient.ToString(), string.Empty, "Created a new client.")); this.Dispatcher.PassBindingFlags[clientIndex] = true; GetNextRequestState state = null; if (getNextRequest) { state = new GetNextRequestState(this.Dispatcher.GetNextRequest, clientIndex); } this.StartClient(state); } catch (Exception e) { BrokerTracing.TraceEvent( TraceEventType.Error, 0, "[RequestSender] .CreateClientAsync: ID = {0}, init client failed: {1}", this.TaskId, e); if (this.IServiceClient != null) { this.CloseClient(); } this.Dispatcher.CloseThis(); } }
/// <summary> /// Invoke the cached callback for specified request queue, which is /// deleted when session is running. /// </summary> /// <param name="requestQueueName"> /// request queue name /// </param> /// <param name="e"> /// exception occurred when access the request queue /// </param> private void TriggerCallbackForInvalidRequestQueue(string requestQueueName, StorageException e) { BrokerTracing.TraceWarning( "[AzureQueueManager].TriggerCallbackForInvalidRequestQueue: Handle the invalid request queue {0}", requestQueueName); this.TriggerCallback(this.requestsMappingToRequestQueue, requestQueueName, e); }
/// <summary> /// Dispose this MSMQMessageFetcher instance. /// </summary> public void SafeDispose() { BrokerTracing.TraceVerbose("[MSMQMessageFetcher] .SafeDispose."); // // SafeDispose: // 1. mark this instance as disposed // 2. wait for all outstanding BeginPeek operations back, and then dispose the cursor. // if (!this.isDisposedField) { this.isDisposedField = true; // dispose prefetched messages this.lockPrefetchCache.EnterWriteLock(); try { if (this.prefetchCache != null) { // below line of code is put inside of prefetchCache lock scope just to ensure it's executed only once this.msmqQueueField.Disposed -= this.OnQueueDisposed; if (!this.prefetchCache.IsEmpty) { BrokerTracing.TraceWarning("[MSMQMessageFetcher] .SafeDispose: PrefetchCache is not empty when disposing."); } foreach (MessageResult result in this.prefetchCache) { if (result.Message != null) { result.Message.Dispose(); } } this.prefetchCache = null; } } finally { this.lockPrefetchCache.ExitWriteLock(); } this.rwlockMessagePeekCursorField.EnterWriteLock(); try { if (this.messagePeekCursorField != null) { this.messagePeekCursorField.Release(); this.messagePeekCursorField = null; } } finally { this.rwlockMessagePeekCursorField.ExitWriteLock(); } } }
/// <summary> /// Invoke the cached callback for specified target queue name. /// </summary> /// <param name="messageIdMapping"> /// mapping from message Id to request/response name /// </param> /// <param name="queueName"> /// target request/response queue name /// </param> /// <param name="e"> /// exception occurred when access the queue /// </param> private void TriggerCallback(ConcurrentDictionary <UniqueId, string> messageIdMapping, string queueName, StorageException e) { BrokerTracing.TraceVerbose( "[AzureQueueManager].TriggerCallback: Handle the invalid queue {0}", queueName); while (messageIdMapping.Values.Contains <string>(queueName, StringComparer.InvariantCultureIgnoreCase)) { List <UniqueId> messageIds = new List <UniqueId>(); string tmpQueueName; foreach (UniqueId id in messageIdMapping.Keys) { if (messageIdMapping.TryGetValue(id, out tmpQueueName)) { if (string.Equals(queueName, tmpQueueName, StringComparison.InvariantCultureIgnoreCase)) { messageIds.Add(id); } } } BrokerTracing.TraceVerbose( "[AzureQueueManager].TriggerCallback: Invoke callback for {0} messages.", messageIds.Count); foreach (UniqueId messageId in messageIds) { QueueAsyncResult result; if (this.callbacks.TryGetValue(messageId, out result)) { BrokerTracing.TraceVerbose( "[AzureQueueManager].TriggerCallback: Get callback for message {0} from callbacks.", messageId); // following method deletes callback and deletes message from mapping this.CompleteCallback(result, null, e); } else { BrokerTracing.TraceWarning( "[AzureQueueManager].TriggerCallback: Can not get callback for message {0} from callbacks.", messageId); } if (!messageIdMapping.TryRemove(messageId, out tmpQueueName)) { BrokerTracing.TraceWarning( "[AzureQueueManager].TriggerCallback: Can not remove message {0} from mapping.", messageId); } } } }
protected override void CloseClient() { if (this.Client == null) { BrokerTracing.TraceWarning("[AzureHttpsRequestSender] .CloseClient: Client is null."); return; } this.Client.Close(); }
/// <summary> /// Invoke the cached callback for specified response queue, which is /// deleted when session is running. /// </summary> /// <param name="e"> /// exception occurred when access the queue /// </param> public void TriggerCallbackForInvalidResponseQueue(ResponseStorageException e) { BrokerTracing.TraceWarning( "[AzureQueueManager].TriggerCallbackForInvalidResponseQueue: Handle the invalid response queue {0}", e.ResponseStorageName); this.responseQueueNotFound.TryAdd(e.ResponseStorageName, e); this.TriggerCallback(this.requestsMappingToResponseQueue, e.ResponseStorageName, e); }
protected override void CloseClient() { if (this.Client == null) { BrokerTracing.TraceWarning("[OnPremiseRequestSender] .CloseClient: Client is null."); return; } this.Client.AsyncClose(); }
public override void BeginExit(Action onFailed) { try { this.OnFailed = onFailed; Binding controllerBinding = null; if (this.https) { controllerBinding = ProxyBinding.BrokerProxyControllerHttpBinding; } else { controllerBinding = ProxyBinding.BrokerProxyControllerBinding; } BrokerTracing.TraceVerbose("[AzureServiceHostController].BeginExit: construct the client. Binding {0}, Endpoint {1} , https = {2}", controllerBinding, this.controllerEndpoint, this.https); ProxyServiceControlClient proxyServiceControlClient = new ProxyServiceControlClient(controllerBinding, this.controllerEndpoint); proxyServiceControlClient.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None; Utility.SetAzureClientCertificate(proxyServiceControlClient.ChannelFactory.Credentials); BrokerTracing.TraceVerbose("[AzureServiceHostController].BeginExit: BeginExit. Binding {0}, Endpoint {1}", controllerBinding, this.controllerEndpoint); this.controllerClient = proxyServiceControlClient; BindingData bindingData = new BindingData(this.binding); proxyServiceControlClient.BeginExit( this.dispatcherInfo.MachineName, this.dispatcherInfo.JobId, this.dispatcherInfo.TaskId, this.dispatcherInfo.FirstCoreId, bindingData, this.EndExit, proxyServiceControlClient); BrokerTracing.TraceVerbose("[AzureServiceHostController].BeginExit: Called. Binding {0}, Endpoint {1}", controllerBinding, this.controllerEndpoint); } catch (Exception e) { BrokerTracing.TraceWarning("[AzureServiceHostController].BeginExit: Error occurs, {0}", e); this.OnFailed(); // If BeginExit fails, dont retry any further. The task likely terminated already if (this.controllerClient != null) { Utility.AsyncCloseICommunicationObject(this.controllerClient); } } }
/// <summary> /// Dispose the PullResponseMessage /// </summary> protected override void DisposeInternal() { base.DisposeInternal(); try { this.completeEvent.Close(); } catch (Exception ex) { BrokerTracing.TraceWarning("[PullResponsesHandler].DisposeInternal: Exception {0}", ex); } }
public void GetRequestAsync(BrokerQueueCallback requestCallback, object state) { ParamCheckUtility.ThrowIfNull(requestCallback, "requestCallback"); bool isCallbackHandled = false; if (this.requestCacheQueue.Count > 0) { BrokerQueueItem request = null; if (!this.requestCacheQueue.TryDequeue(out request)) { BrokerTracing.TraceInfo("[BrokerQueueDispatcher] .GetRequestAsync: All cached requests are dispatched."); } if (request != null) { try { #if DEBUG BrokerTracing.TraceVerbose("[BrokerQueueDispatcher] .GetRequestAsync: handle request callback from cache queue. request id={0}", GetMessageId(request)); #endif this.RegisterReemit(request); isCallbackHandled = true; requestCallback(request, state); } catch (Exception e) { this.requestCacheQueue.Enqueue(request); // request callback raise exception. BrokerTracing.TraceWarning("[BrokerQueueDispatcher] .GetRequestAsync: The request callback raise exception. Exception: {0}", e); } } } if (this.requestCacheQueue.Count <= this.watermarkerForTriggerPrefetch) { BrokerTracing.TraceVerbose("[BrokerQueueDispatcher] .GetRequestAsync (perf): Trigger prefetch because the count of cached items is below threshold. state={0}", (int)state); this.TriggerPrefetch(); } if (!isCallbackHandled) { this.requestCallbackQueue.Enqueue(new BrokerQueueCallbackItem(requestCallback, state)); // in case the last request come in the cache queue right before the request callback enqueue. this.HandlePendingRequestCallback(); } }
public void Dispose() { try { this.brokerQueueFactory.RemovePersistQueueByClient(this.ClientId); } catch (Exception e) { BrokerTracing.TraceWarning("[BrokerQueue] .Dispose: remove the broker queue from the broker queue factory cached raised exception, {0}", e); } this.Dispose(true); GC.SuppressFinalize(this); }
/// <summary> /// Ask the broker manager to close this broker /// </summary> /// <param name="suspend">indicating whether to suspend</param> internal void UnloadBroker(bool suspend) { BrokerTracing.TraceEvent(TraceEventType.Information, 0, "[BrokerEntry] Unload broker domain, ID = {0}", this.sharedData.BrokerInfo.SessionId); try { this.Close(!suspend).GetAwaiter().GetResult(); BrokerTracing.TraceInfo("[BrokerEntry] Self Cleanup: Close succeeded"); } catch (Exception e) { BrokerTracing.TraceWarning("[BrokerEntry] Self Cleanup: Close failed: {0}", e); } }
/// <summary> /// Safe get IsFault property from a message instance /// </summary> /// <param name="message">indicating the message instance</param> /// <returns>returns the value of IsFault property, returns false if exception occured</returns> private static bool SafeGetIsFault(Message message) { try { return(message.IsFault); } catch (Exception ex) { BrokerTracing.TraceWarning("[ResponseQueueAdapter].SafeGetIsFault: Exception {0}", ex); // Swallow exception and return false return(false); } }
internal void DispatchEvent(BrokerQueueEventId eventId, EventArgs eventArgs) { if (this.OnEvent != null) { try { this.OnEvent(eventId, eventArgs); } catch (Exception e) { BrokerTracing.TraceWarning("[BrokerQueue] .DispatchEvent: the event handler raised exception, {0}", e); } } }
public static async Task <CloudQueue> CreateQueueAsync( string connectString, string sessionId, string queueName, string clientId, bool isRequest, string note) { var info = new QueueInfo(sessionId, queueName, clientId, isRequest, note); try { var table = GetTableClient(connectString).GetTableReference(queueTableName); await table.CreateIfNotExistsAsync(); var insertOperation = TableOperation.Insert(info); await table.ExecuteAsync(insertOperation); } catch (Exception e) { BrokerTracing.TraceError( "[AzureStorageTool] .CreateQueueAsync: queueName={0} create info to table failed, the exception, {1}", queueName, e); throw; } try { var queue = GetQueueClient(connectString).GetQueueReference(queueName); if (await queue.CreateIfNotExistsAsync()) { return(queue); } BrokerTracing.TraceWarning( "[AzureStorageTool] .CreateQueueAsync: queueName={0} has existed.", queueName); throw new Exception("Queue with the queueName has existed."); } catch (Exception e) { BrokerTracing.TraceError( "[AzureStorageTool] .CreateQueueAsync: queueName={0} create queue failed, the exception, {1}", queueName, e); throw; } }
/// <summary> /// Initializes a new instance of the WssDispatcher class /// </summary> /// <param name="info">indicating the dispatcher info</param> /// <param name="binding">binding information</param> /// <param name="sharedData">indicating the shared data</param> /// <param name="observer">indicating the observer</param> /// <param name="queueFactory">indicating the queue factory</param> /// <param name="dispatcherIdle">set when the dispatcher enters idle status</param> public WssDispatcher(DispatcherInfo info, Binding binding, SharedData sharedData, BrokerObserver observer, BrokerQueueFactory queueFactory, SchedulerAdapterClientFactory schedulerAdapterClientFactory, AutoResetEvent dispatcherIdle) : base(info, binding, sharedData, observer, queueFactory, schedulerAdapterClientFactory, dispatcherIdle) { if (binding is BasicHttpBinding) { BasicHttpBinding httpBinding = binding as BasicHttpBinding; httpBinding.Security.Mode = BasicHttpSecurityMode.Message; httpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate; httpBinding.Security.Message.AlgorithmSuite = System.ServiceModel.Security.SecurityAlgorithmSuite.Basic128; } else { BrokerTracing.TraceWarning("[WssDispatcher]. The binding type is not HTTP {0}.", binding.GetType().ToString()); } }
internal void OnFatalException(Exception fatalException) { if (this.OnFatalExceptionEvent != null) { try { ExceptionEventArgs fatalExceptionEventArgs = new ExceptionEventArgs(fatalException, this); this.OnFatalExceptionEvent(this, fatalExceptionEventArgs); } catch (Exception e) { BrokerTracing.TraceWarning("[BrokerQueue] .OnFatalException: OnFatalExceptionEvent raised exception, {0}", e); } } }
/// <summary> /// Handle client failure /// </summary> /// <param name="client">targeted client</param> private static void HandleClientFailure(AzureServiceClient client) { try { BrokerTracing.TraceWarning( "[AzureDispatcher] HandleClientFailure: Handle invalid client, {0}, {1}", client, client.ServiceClient.Endpoint.Address); Dictionary <EndpointAddress, ProxyClientPool> .ValueCollection pools; lock (LockProxyClientPoolDic) { pools = ProxyClientPoolDic.Values; } foreach (var pool in pools) { bool existInPool = false; lock (pool) { BrokerTracing.TraceVerbose( "[AzureDispatcher] HandleClientFailure: Remove client {0} from pool.", client); existInPool = pool.RemoveProxyClient(client); } if (existInPool) { BrokerTracing.TraceVerbose( "[AzureDispatcher] HandleClientFailure: Close client {0}", client); // Close the proxy client if any exception is encountered. // As a result, async pending callback on clients will be // invoked (with exception). client.AsyncClose(); return; } } } catch (Exception e) { BrokerTracing.TraceError( "[AzureDispatcher] HandleClientFailure: Error occurs, {0}", e); } }
/// <summary> /// Put a single request item into the storage. /// </summary> /// <param name="request">the single request that need be stored to the persistenc</param> /// <param name="putRequestCallback">the callback function that will be called once the async operation finish or exception raise.</param> /// <param name="callbackState">the state object for the callback.</param> public async Task PutRequestAsync(BrokerQueueItem request, PutRequestCallback putRequestCallback, object callbackState) { if (this.isClosedField) { BrokerTracing.TraceWarning("[MemoryPersist] .GetRequestAsync: the queue is closed."); return; } request.PersistAsyncToken.AsyncToken = this.PersistToken; this.requestQueueField.Enqueue(request); Interlocked.Increment(ref this.allRequestCountField); Interlocked.Increment(ref this.requestCountField); PutRequestComplete(putRequestCallback, callbackState); }
/// <summary> /// Trace warning level log. /// </summary> /// <param name="className">class name</param> /// <param name="methodName">method name</param> /// <param name="format">message format</param> /// <param name="args">arguments of message format</param> public static void TraceWarning(string className, string methodName, string format, params object[] args) { string traceMessage = SoaHelper.CreateTraceMessage(className, methodName, format, args); #if PROXY Microsoft.Hpc.BrokerProxy.AzureBrokerProxyTrace.TraceWarning(traceMessage); #elif DATAPROXY Microsoft.Hpc.Scheduler.Session.Data.Internal.DataProxyTrace.TraceWarning(traceMessage); #elif DATASVC Microsoft.Hpc.Scheduler.Session.Data.Internal.DataServiceTraceHelper.TraceEvent(TraceEventType.Warning, traceMessage); #elif CONSOLE Console.Out.WriteLine(string.Format("{0} - {1}", DateTime.Now, traceMessage)); #else BrokerTracing.TraceWarning(traceMessage); #endif }
/// <summary> /// If parameter serviceClient is in the pool, clear the pool and return the list items. /// The invoker of this method will async close returned clients outside a lock scope. /// </summary> /// <returns>the list items</returns> public AzureServiceClient[] Clear(AzureServiceClient serviceClient) { if (serviceClient != null && this.clientPool.Contains(serviceClient)) { AzureServiceClient[] clients = this.clientPool.ToArray(); this.clientPool.Clear(); this.clientRefCounts.Clear(); BrokerTracing.TraceWarning("[ProxyClientPool]. Clear: Client {0} is in the pool, so clear the pool {1}.", serviceClient, this.proxyEpr.ToString()); return(clients); } else { BrokerTracing.TraceWarning("[ProxyClientPool]. Clear: Client {0} is not in the pool {1}.", serviceClient, this.proxyEpr.ToString()); return(null); } }
/// <summary> /// Dispose the object /// </summary> /// <param name="disposing">indicating whether it is disposing</param> private void Dispose(bool disposing) { if (disposing) { this.stoped = true; try { this.timer?.Dispose(); this.timer = null; } catch (Exception e) { BrokerTracing.TraceWarning("[RepeatableCallbackTrigger] Exception thrown while disposing: {0}", e); } } }
/// <summary> /// Exit service host /// </summary> /// <param name="dispatcherInfo"></param> private void ExitServiceHost(DispatcherInfo dispatcherInfo) { var controller = Dispatcher.CreateController(dispatcherInfo, this.defaultBinding, this.httpsBurst); BrokerTracing.TraceInfo("[DispatcherManager] .ExitServiceHost: Calling BeginExit for task id {0}, {1}", dispatcherInfo.UniqueId, dispatcherInfo.ServiceHostControllerAddress); controller.BeginExit(() => { try { this.monitor.FinishTask(dispatcherInfo).GetAwaiter().GetResult(); } catch (Exception e) { BrokerTracing.TraceWarning("[ServiceHostController] .BeginExit: onFailed callback exception for task id {0} : {1}", dispatcherInfo.UniqueId, e.ToString()); } }); }