static private void SendPackages(DestinationInfo[] destinations) { foreach (DestinationInfo dInfo in destinations) { try { ReflectInsightPackage[] messages = dInfo.GetInterimMessages(); if (messages.Length > 0) { try { InvokeListeners.Receive(dInfo, dInfo.GetInterimMessages()); } finally { dInfo.ClearInterimMessageQueue(); DebugManager.Sleep(0); } } } catch (ThreadAbortException) { } catch (Exception ex) { if (RIExceptionManager.CanEvent(ex)) { RIExceptionManager.Publish(new ReflectInsightException(String.Format("MessageManager.InvokeListeners: unhandled exception was detected in destination message loop for destination: {0}", dInfo.Name), ex)); } RIEventManager.DoOnQueueException(ex); } } }
static private void ExecuteProcessMessages() { try { while (true) { Thread.Sleep(FSleep); ProcessMessages(); if (DebugManager.DebugMessageProcessEnabled) { continue; } lock (FLockObject) { if (!MessageQueue.HasMessages) { break; } } Thread.Sleep(FSleep); } } catch (ThreadAbortException) { } catch (Exception ex) { RIExceptionManager.PublishIfEvented(new ReflectInsightException("MessageManager.ExecuteProcessMessages detected an unhandled exception. Please see inner exception for more details.", ex)); RIEventManager.DoOnQueueException(ex); } finally { IsProcessing = false; } }