Exemple #1
0
 internal void Access(OpenBy openBy)
 {
     if (openBy == OpenBy.Consumer)
     {
         this.externalRefCount++;
     }
     this.lastAccessed = DelegateSessionEntry.GetNextWaterMark();
 }
Exemple #2
0
        internal DelegateSessionEntry GetDelegateSessionEntry(IExchangePrincipal principal, OpenBy openBy)
        {
            MailboxSession       mailboxSession       = null;
            DelegateSessionEntry delegateSessionEntry = null;
            bool flag = false;

            try
            {
                if (!this.DelegateSessionCacheInstance.TryGet(principal, openBy, out delegateSessionEntry))
                {
                    mailboxSession       = MailboxSession.InternalOpenDelegateAccess(this.masterMailboxSession, principal);
                    delegateSessionEntry = this.DelegateSessionCacheInstance.Add(new DelegateSessionEntry(mailboxSession, openBy));
                }
                if (!delegateSessionEntry.IsConnected)
                {
                    delegateSessionEntry.Connect();
                }
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    if (delegateSessionEntry != null)
                    {
                        this.DelegateSessionCacheInstance.RemoveEntry(delegateSessionEntry);
                    }
                    else if (mailboxSession != null)
                    {
                        mailboxSession.CanDispose = true;
                        mailboxSession.Dispose();
                        mailboxSession = null;
                    }
                }
            }
            return(delegateSessionEntry);
        }
 internal DelegateSessionHandle(DelegateSessionEntry entry)
 {
     this.entry          = entry;
     this.disposeTracker = this.GetDisposeTracker();
 }