// Token: 0x06000274 RID: 628 RVA: 0x0000DE40 File Offset: 0x0000C040
 private void InitFromWatermark(EventAccess eventAccess, MapiEvent[] eventTable, long databaseCounter)
 {
     if (this.committedWatermark != 0L && this.committedWatermark < databaseCounter)
     {
         ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate>((long)this.GetHashCode(), "{0}: Searching for retryEvent...", this);
         MapiEvent mapiEvent;
         if (eventTable != null)
         {
             mapiEvent = this.FindNextEventForMailboxFromEventTable(eventTable, this.committedWatermark + 1L);
         }
         else
         {
             mapiEvent = this.FindNextEventForMailbox(eventAccess, this.committedWatermark + 1L);
         }
         if (mapiEvent != null && mapiEvent.EventCounter < databaseCounter)
         {
             ExTraceGlobals.EventDispatcherTracer.TraceDebug((long)this.GetHashCode(), "{0}: Starting in retry.  mailboxWatermark: {1}, databaseCounter: {2}, retryEvent: {3}", new object[]
             {
                 this,
                 this.committedWatermark,
                 databaseCounter,
                 mapiEvent.EventCounter
             });
             this.IsInRetry = true;
             ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate>((long)this.GetHashCode(), "{0}: Starting in retry.", this);
             base.Assistant.PerformanceCounters.FailedDispatchers.Increment();
             base.EnqueueItem(InterestingEvent.CreateUnprocessed(mapiEvent));
         }
     }
 }
 // Token: 0x06000277 RID: 631 RVA: 0x0000E21C File Offset: 0x0000C41C
 private void DispatchOneEvent(EmergencyKit kit, InterestingEvent interestingEvent)
 {
     ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long>((long)this.GetHashCode(), "{0}: DispatchOneEvent {1}", this, kit.MapiEvent.EventCounter);
     if (!base.Assistants.NeedsMailboxSession)
     {
         this.HandleEventWithoutSession(kit, interestingEvent);
         return;
     }
     this.parentMailboxDispatcher.DispatchEvent(interestingEvent, delegate(ExchangePrincipal mailboxOwner)
     {
         bool flag = this.ShouldProcessMailbox(mailboxOwner);
         this.Assistant.PerformanceCounters.QueuedEventsDiscardedByMailboxFilterBase.Increment();
         if (!flag)
         {
             ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, MapiEvent>((long)this.GetHashCode(), "{0}: A previously queued event has been discarded by the mailbox filter. Event: {1}", this, kit.MapiEvent);
             this.Assistant.PerformanceCounters.QueuedEventsDiscardedByMailboxFilter.Increment();
         }
         return(flag);
     }, delegate(MailboxSession mailboxSession)
     {
         using (Item item = this.TryOpenItem(mailboxSession, kit.MapiEvent))
         {
             this.HandleEvent(kit, interestingEvent, mailboxSession, item);
         }
     }, (base.Assistant != null) ? base.Assistant.Name : "<null>");
 }
 // Token: 0x06000271 RID: 625 RVA: 0x0000DC20 File Offset: 0x0000BE20
 protected override void OnTransientFailure(InterestingEvent interestingEvent, AIException exception)
 {
     if (exception is TransientMailboxException)
     {
         ExTraceGlobals.EventDispatcherTracer.TraceError <EventDispatcherPrivate, long, AIException>((long)this.GetHashCode(), "{0}: retryable mailbox exception, mapiEvent {1}: {2}", this, interestingEvent.MapiEvent.EventCounter, exception);
         lock (base.Locker)
         {
             this.ClearPendingQueue();
             if (!this.IsInRetry)
             {
                 if (this.IsMailboxDead && ExTraceGlobals.EventDispatcherTracer.IsTraceEnabled(TraceType.DebugTrace))
                 {
                     ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate>((long)this.GetHashCode(), "{0}: Mailbox had been on TransientFailure, but was found dead", this);
                 }
                 this.isInRetry = true;
                 base.Controller.DecrementEventQueueCount();
                 base.Assistant.PerformanceCounters.FailedDispatchers.Increment();
                 if (EventDispatcherPrivate.syncWithTestCodeAfterEventQueueCountDecrementedForRetry != null)
                 {
                     EventDispatcherPrivate.syncWithTestCodeAfterEventQueueCountDecrementedForRetry();
                 }
             }
         }
     }
 }
 // Token: 0x0600026B RID: 619 RVA: 0x0000D7D8 File Offset: 0x0000B9D8
 protected override void EnqueueEvent(InterestingEvent interestingEvent)
 {
     ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long>((long)this.GetHashCode(), "{0}: queueing event {1}...", this, interestingEvent.MapiEvent.EventCounter);
     lock (base.Locker)
     {
         if (base.Shutdown)
         {
             ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long>((long)this.GetHashCode(), "{0}: Not queueing event {1} for shutdown mailbox", this, interestingEvent.MapiEvent.EventCounter);
         }
         else if (this.IsMailboxDead)
         {
             ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long>((long)this.GetHashCode(), "{0}: Not queueing event {1} for dead mailbox", this, interestingEvent.MapiEvent.EventCounter);
         }
         else if (this.IsInRetry)
         {
             ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long>((long)this.GetHashCode(), "{0}: Not queueing event {1} for retry mailbox", this, interestingEvent.MapiEvent.EventCounter);
         }
         else
         {
             base.EnqueueEvent(interestingEvent);
             ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long, long>((long)this.GetHashCode(), "{0}: Queued event {1}, old highestEventQueued: {2}", this, interestingEvent.MapiEvent.EventCounter, this.highestEventQueued);
             this.highestEventQueued = Math.Max(this.highestEventQueued, interestingEvent.MapiEvent.EventCounter);
         }
     }
 }
 // Token: 0x06000270 RID: 624 RVA: 0x0000DBB8 File Offset: 0x0000BDB8
 protected override void OnCompletedItem(InterestingEvent interestingEvent, AIException exception)
 {
     base.OnCompletedItem(interestingEvent, exception);
     if (this.IsInRetry && !this.IsMailboxDead)
     {
         ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long>((long)this.GetHashCode(), "{0}: Recovering from retry state, mapiEvent {1}", this, interestingEvent.MapiEvent.EventCounter);
         this.recoveryEventCounter = interestingEvent.MapiEvent.EventCounter + 1L;
         this.ControllerPrivate.RequestRecovery(this);
     }
 }
        // Token: 0x0600026F RID: 623 RVA: 0x0000DA84 File Offset: 0x0000BC84
        protected override AIException DangerousProcessItem(EmergencyKit kit, InterestingEvent interestingEvent)
        {
            ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long>((long)this.GetHashCode(), "{0}: Dequeued event {1}", this, interestingEvent.MapiEvent.EventCounter);
            long        lastEventCounter = 0L;
            AIException ex = null;

            try
            {
                base.CatchMeIfYouCan(delegate
                {
                    try
                    {
                        this.DispatchOneEvent(kit, interestingEvent);
                    }
                    catch (DeadMailboxException ex3)
                    {
                        ExTraceGlobals.EventDispatcherTracer.TraceError <EventDispatcherPrivate, DeadMailboxException>((long)this.GetHashCode(), "{0}: Encountered DeadMailboxException #1: {1}", this, ex3);
                        lastEventCounter = this.ControllerPrivate.GetLastEventCounter();
                        ExTraceGlobals.EventDispatcherTracer.TraceError((long)this.GetHashCode(), "{0}: Read lastEventCounter {1} after DeadMailboxExcetion.  Retrying eventDispatch {2}.  Previous exception: {3}", new object[]
                        {
                            this,
                            lastEventCounter,
                            interestingEvent.MapiEvent.EventCounter,
                            ex3
                        });
                        this.DispatchOneEvent(kit, interestingEvent);
                        ExTraceGlobals.EventDispatcherTracer.TraceDebug <EventDispatcherPrivate, long>((long)this.GetHashCode(), "{0}: DispatchOneEvent returned successfully for mapiEvent {1}", this, interestingEvent.MapiEvent.EventCounter);
                    }
                }, (base.Assistant != null) ? base.Assistant.Name : "<null>");
            }
            catch (AIException ex2)
            {
                ExTraceGlobals.EventDispatcherTracer.TraceError <EventDispatcherPrivate, AIException>((long)this.GetHashCode(), "{0}: Exception from DispatchOneEvent: {1}", this, ex2);
                ex = ex2;
            }
            if (ex is DeadMailboxException)
            {
                ExTraceGlobals.EventDispatcherTracer.TraceError((long)this.GetHashCode(), "{0}: Encountered DeadMailboxException #2.  mapiEvent: {1}, lastEventCounter: {2}, exception: {3}", new object[]
                {
                    this,
                    interestingEvent.MapiEvent.EventCounter,
                    lastEventCounter,
                    ex
                });
                this.SetAsDeadMailbox(interestingEvent.MapiEvent.EventCounter, lastEventCounter);
            }
            return(ex);
        }
Exemple #7
0
 public void DispatchEvent(InterestingEvent interestingEvent, MailboxDispatcher.MailboxFilterDelegate mailboxFilterMethod, MailboxDispatcher.DispatchDelegate eventHandlerMethod, string nonLocalizedAssistantName)
 {
     lock (this.mailboxSessionLocker)
     {
         this.LoadMailboxOwner(interestingEvent.MapiEvent.TenantHint, nonLocalizedAssistantName);
         if (!mailboxFilterMethod(this.mailboxOwner))
         {
             ExTraceGlobals.EventDispatcherTracer.TraceDebug <MailboxDispatcher>((long)this.GetHashCode(), "{0}: Discarding event since the assistant is no longer interested in it after inspecting the mailbox owner.", this);
         }
         else
         {
             this.ConnectMailboxSession(nonLocalizedAssistantName);
             eventHandlerMethod(this.mailboxSession);
         }
     }
 }
Exemple #8
0
        // Token: 0x06000280 RID: 640 RVA: 0x0000E4FC File Offset: 0x0000C6FC
        protected override AIException DangerousProcessItem(EmergencyKit kit, InterestingEvent interestingEvent)
        {
            AIException result = null;

            try
            {
                base.CatchMeIfYouCan(delegate
                {
                    this.HandleEvent(kit, interestingEvent, null, null);
                }, (base.Assistant != null) ? base.Assistant.Name : "<null>");
            }
            catch (AIException ex)
            {
                ExTraceGlobals.EventDispatcherTracer.TraceError <EventDispatcherPublic, AIException>((long)this.GetHashCode(), "{0}: Exception from HandleEvent: {1}", this, ex);
                result = ex;
            }
            return(result);
        }
 // Token: 0x06000279 RID: 633 RVA: 0x0000E438 File Offset: 0x0000C638
 private void HandleEventWithoutSession(EmergencyKit kit, InterestingEvent interestingEvent)
 {
     base.HandleEvent(kit, interestingEvent, null, null);
 }