Ejemplo n.º 1
0
        protected void ReceivedUpdate()
        {
            IMdbSystemMailboxPinger mdbSystemMailboxPinger = this.pingerReference;

            if (mdbSystemMailboxPinger == null && PingerCache.CreatePingerTestHook != null)
            {
                mdbSystemMailboxPinger = PingerCache.CreatePingerTestHook(this.MdbGuid);
            }
            if (mdbSystemMailboxPinger != null)
            {
                if (mdbSystemMailboxPinger.Pinging)
                {
                    ExTraceGlobals.DatabasePingerTracer.TraceDebug <Guid>((long)this.GetHashCode(), "RPC traffic due to database pinger for Mdb: {0}", this.MdbGuid);
                    Interlocked.Increment(ref this.consecutivePings);
                }
                else
                {
                    Interlocked.Exchange(ref this.consecutivePings, 0);
                }
                if (PingerDependentHealthMonitor.OnPingIntervalUpdate != null)
                {
                    PingerDependentHealthMonitor.OnPingIntervalUpdate(base.Key, this.consecutivePings, this.CurrentPingInterval);
                }
            }
        }
Ejemplo n.º 2
0
        protected override IMdbSystemMailboxPinger CreateOnCacheMiss(Guid key, ref bool shouldAdd)
        {
            shouldAdd = true;
            if (PingerCache.CreatePingerTestHook != null)
            {
                return(PingerCache.CreatePingerTestHook(key));
            }
            IDatabaseInformation databaseInformation = DatabaseInformationCache.Singleton.Get(key);

            if (databaseInformation != null)
            {
                ExTraceGlobals.DatabasePingerTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "[PingerCache.CreateOnCacheMiss] Acquire database information for Mdb: {0}, Guid: {1}", databaseInformation.DatabaseName, databaseInformation.DatabaseGuid);
                return(new MdbSystemMailboxPinger(key));
            }
            ExTraceGlobals.DatabasePingerTracer.TraceDebug <Guid>((long)this.GetHashCode(), "[PingerCache.CreateOnCacheMiss] Failed to get database information for Mdb Guid: {0}.  NOT creating pinger - caching null instead.", key);
            return(null);
        }