internal void Access(OpenBy openBy) { if (openBy == OpenBy.Consumer) { this.externalRefCount++; } this.lastAccessed = DelegateSessionEntry.GetNextWaterMark(); }
internal bool TryGet(IExchangePrincipal principal, OpenBy openBy, out DelegateSessionEntry entry) { entry = null; if (principal == null || string.IsNullOrEmpty(principal.LegacyDn)) { return(false); } entry = this.FindEntry(principal); if (entry == null) { return(false); } entry.Access(openBy); return(true); }
private DelegateSessionEntry(string mailboxLegacyDn, MailboxSession mailboxSession, OpenBy openBy) { this.mailboxLegacyDn = mailboxLegacyDn; this.mailboxSession = mailboxSession; this.stackTrace = new StackTrace(); this.Access(openBy); }
internal DelegateSessionEntry(MailboxSession mailboxSession, OpenBy openBy) : this(mailboxSession.MailboxOwnerLegacyDN, mailboxSession, openBy) { }
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); }