private MailboxDispatcher GetDispatcherForMailbox(Guid mailboxGuid, long eventCounter)
        {
            MailboxDispatcher mailboxDispatcher = null;
            bool flag2;

            lock (this.dispatchers)
            {
                flag2 = this.dispatchers.TryGetValue(mailboxGuid, out mailboxDispatcher);
            }
            if (!flag2)
            {
                ExTraceGlobals.EventControllerTracer.TraceDebug <EventControllerPrivate, Guid>((long)this.GetHashCode(), "{0}: creating dispatcher for mailbox {1}", this, mailboxGuid);
                bool dispatcherIsUpToDate = false;
                lock (this.upToDateDispatchers)
                {
                    dispatcherIsUpToDate = this.upToDateDispatchers.Contains(mailboxGuid);
                }
                Bookmark bookmark = null;
                if (this.initialBookmarks != null && this.initialBookmarks.Remove(mailboxGuid, out bookmark) && bookmark != null && bookmark.Identity != Guid.Empty)
                {
                    ExTraceGlobals.EventControllerTracer.TraceDebug <EventControllerPrivate, Bookmark>((long)this.GetHashCode(), "{0}: Initializing mailbox dispatcher from {1}", this, bookmark);
                    mailboxDispatcher = MailboxDispatcher.CreateFromBookmark(this, base.EventAccess, null, bookmark, base.DatabaseBookmark);
                }
                if (mailboxDispatcher == null)
                {
                    mailboxDispatcher = MailboxDispatcher.CreateWithoutBookmark(this, base.EventAccess, mailboxGuid, base.DatabaseBookmark, dispatcherIsUpToDate);
                }
                lock (this.dispatchers)
                {
                    this.dispatchers[mailboxGuid] = mailboxDispatcher;
                }
                this.UpdateNumberOfDispatchers();
            }
            return(mailboxDispatcher);
        }
Пример #2
0
        public static MailboxDispatcher CreateWithoutBookmark(EventControllerPrivate controller, EventAccess eventAccess, Guid mailboxGuid, Bookmark databaseBookmark, bool dispatcherIsUpToDate)
        {
            Bookmark mailboxBookmark = eventAccess.GetMailboxBookmark(mailboxGuid, databaseBookmark, dispatcherIsUpToDate);

            return(MailboxDispatcher.CreateFromBookmark(controller, eventAccess, null, mailboxBookmark, databaseBookmark));
        }