public bool LockAndReconnectMailboxSession(int timeout)
 {
     if (this.mailboxSessionLock.LockWriterElastic(timeout))
     {
         return(UserContextUtilities.ReconnectStoreSession(this.MailboxSession, this));
     }
     throw new OwaLockTimeoutException("User context could not acquire the mailbox session writer lock", null, this);
 }
Beispiel #2
0
 private void RefreshMailboxSession(EcpUserSettings userSettings)
 {
     base.UserContextDiposeGraph.Append(".ur1");
     if ((userSettings & EcpUserSettings.Regional) == EcpUserSettings.Regional)
     {
         ExTimeZone exTimeZone = null;
         try
         {
             if (this.mailboxSessionLock.LockWriterElastic(3000))
             {
                 base.UserContextDiposeGraph.Append(".ur2");
                 if (base.NotificationManager != null)
                 {
                     base.UserContextDiposeGraph.Append(".ur3");
                     base.NotificationManager.CleanupSubscriptions();
                 }
                 if (this.mailboxSession != null)
                 {
                     base.UserContextDiposeGraph.Append(".ur4");
                     base.DisposeMailboxSession();
                 }
                 this.mailboxSession          = this.CreateMailboxSession();
                 this.isMailboxSessionCreated = true;
                 UserContextUtilities.ReconnectStoreSession(this.mailboxSession, this);
                 exTimeZone = TimeZoneHelper.GetUserTimeZone(this.mailboxSession);
             }
         }
         finally
         {
             if (this.mailboxSessionLock.IsWriterLockHeld)
             {
                 if (this.mailboxSession != null)
                 {
                     base.UserContextDiposeGraph.Append(".ur5");
                     base.UnlockAndDisconnectMailboxSession();
                 }
                 else
                 {
                     base.UserContextDiposeGraph.Append(".ur6");
                     this.mailboxSessionLock.ReleaseWriterLock();
                 }
             }
         }
         if (exTimeZone != null && base.NotificationManager != null)
         {
             base.NotificationManager.RefreshSubscriptions(exTimeZone);
         }
     }
     base.UserContextDiposeGraph.Append(".ur7");
 }