예제 #1
0
        private void TimeoutCallback(object state, bool timedOut)
        {
            this.UnregisterWaitHandle();
            TimeSpan timeSpan = TimeProvider.UtcNow - this.lastPingAttemptUtc;

            if (timeSpan < MdbSystemMailboxPinger.PingTimeout)
            {
                ExTraceGlobals.DatabasePingerTracer.TraceError <TimeSpan, TimeSpan, Guid>((long)this.GetHashCode(), "Timeout was called before PingTimeout reached.  Ignoring.  Elapsed: {0}, PingTimeout: {1}, Database: {2}", timeSpan, MdbSystemMailboxPinger.PingTimeout, this.databaseGuid);
                return;
            }
            if (timedOut)
            {
                PingerPerfCounterWrapper.PingTimedOut();
                if (MdbSystemMailboxPinger.OnPingTimeout != null)
                {
                    MdbSystemMailboxPinger.OnPingTimeout(this.databaseGuid, MdbSystemMailboxPinger.PingTimeout);
                }
                ExTraceGlobals.DatabasePingerTracer.TraceError <Guid>((long)this.GetHashCode(), "Ping for Mdb '{0}' timed out.  This might suggest that the remote server is down.", this.databaseGuid);
                StorageGlobals.EventLogger.LogEvent(StorageEventLogConstants.Tuple_ErrorDatabasePingTimedOut, string.Empty, new object[]
                {
                    this.databaseGuid,
                    timeSpan,
                    (this.lastSuccessfulPingUtc == DateTime.MinValue) ? "[never]" : this.lastSuccessfulPingUtc.ToString()
                });
            }
        }
예제 #2
0
        private bool OpenSession()
        {
            bool flag = false;

            if (this.AcquireADObjectsForPrivateMdb())
            {
                using (MailboxSession mailboxSession = this.GetMailboxSession())
                {
                    bool flag2 = false;
                    try
                    {
                        lock (this.instanceLock)
                        {
                            if (this.registeredWaitHandle == null && this.remoteCallDoneEvent != null)
                            {
                                this.remoteCallDoneEvent.Reset();
                                this.registeredWaitHandle = ThreadPool.RegisterWaitForSingleObject(this.remoteCallDoneEvent, this.waitOrTimerCallback, null, MdbSystemMailboxPinger.PingTimeout, true);
                                flag2 = true;
                            }
                        }
                        if (MdbSystemMailboxPinger.OnTestPing != null)
                        {
                            flag = MdbSystemMailboxPinger.OnTestPing(this.databaseGuid, this);
                        }
                        else
                        {
                            mailboxSession.Mailbox.ForceReload(new PropertyDefinition[]
                            {
                                MailboxSchema.QuotaUsedExtended
                            });
                            flag = true;
                        }
                        if (flag)
                        {
                            this.pingerState = MdbSystemMailboxPinger.PingerState.Normal;
                        }
                    }
                    finally
                    {
                        if (flag2)
                        {
                            this.UnregisterWaitHandle();
                        }
                    }
                }
            }
            if (flag)
            {
                this.lastSuccessfulPingUtc = TimeProvider.UtcNow;
                ExTraceGlobals.DatabasePingerTracer.TraceDebug <Guid>((long)this.GetHashCode(), "Successfully pinged database {0}", this.databaseGuid);
            }
            return(flag);
        }