public void UpdateBucketStats(Common.Stats.ShardInfo shardInfo)
        {
            _syncLock.AcquireWriterLock(Timeout.Infinite);
            try
            {
                if (shardInfo == null)
                {
                    return;
                }

                if (_bucketsStats == null)
                {
                    _bucketsStats = new BucketStatistics();
                }

                if (shardInfo.Statistics != null && shardInfo.Statistics.LocalBuckets != null)
                {
                    var bucketStats = shardInfo.Statistics.LocalBuckets;
                    if (bucketStats != null)
                    {
                        IEnumerator <KeyValuePair <HashMapBucket, BucketStatistics> > ide = bucketStats.GetEnumerator();
                        while (ide.MoveNext())
                        {
                            if (_nonShardedDistribution.Bucket.CurrentShard.Equals(shardInfo.ShardName))
                            {
                                BucketStatistics stats = ide.Current.Value;

                                _bucketsStats = stats;
                            }
                        }
                    }
                }
            }

            /* catch (Exception e)
             * {
             *   if (NCacheLog != null && NCacheLog.IsErrorEnabled) NCacheLog.Error("DistributionMgr.UpdateBucketStats()", e.ToString());
             * }*/
            finally
            {
                _syncLock.ReleaseWriterLock();
            }
        }
Exemple #2
0
 public void UpdateBucketStatistics(string cluster, string database, string collection, Common.Stats.ShardInfo shardInfo)
 {
     _session.UpdateBucketStatistics(cluster, database, collection, shardInfo);
 }