Beispiel #1
0
 public RedisCardioPulseStatus(IRedisHeartBeatProbe probe, RedisCardioProbeStatus currentStatus,
                               RedisCardioProbeStatus newStatus, long failCount, long successCount)
     : this()
 {
     Probe         = probe;
     NewStatus     = newStatus;
     CurrentStatus = currentStatus;
     FailCount     = failCount;
     SuccessCount  = successCount;
 }
Beispiel #2
0
 private bool CanSetStatus(RedisCardioProbeStatus status)
 {
     try
     {
         if (status != m_Status)
         {
             var onSetStatus = m_OnSetStatus;
             if (onSetStatus != null)
             {
                 return(onSetStatus(this, new RedisCardioPulseStatus(m_Probe, m_Status, status, m_FailCount, m_SuccessCount)));
             }
         }
     }
     catch (Exception)
     { }
     return(true);
 }
Beispiel #3
0
 private void SetCounters(RedisCardioProbeStatus status)
 {
     if (status == RedisCardioProbeStatus.OK)
     {
         Interlocked.Exchange(ref m_FailCount, 0);
         if (m_SuccessCount < int.MaxValue)
         {
             Interlocked.Add(ref m_SuccessCount, 1);
         }
     }
     else
     {
         Interlocked.Exchange(ref m_SuccessCount, 0);
         if (m_FailCount < int.MaxValue)
         {
             Interlocked.Add(ref m_FailCount, 1);
         }
     }
 }
Beispiel #4
0
 private void SetCounters(RedisCardioProbeStatus status)
 {
     if (status == RedisCardioProbeStatus.OK)
     {
         Interlocked.Exchange(ref m_FailCount, RedisConstants.Zero);
         if (Interlocked.Read(ref m_SuccessCount) < long.MaxValue)
         {
             Interlocked.Add(ref m_SuccessCount, RedisConstants.One);
         }
     }
     else
     {
         Interlocked.Exchange(ref m_SuccessCount, RedisConstants.Zero);
         if (Interlocked.Read(ref m_FailCount) < long.MaxValue)
         {
             Interlocked.Add(ref m_FailCount, RedisConstants.One);
         }
     }
 }