Beispiel #1
0
        protected DistributionMaps GetMapsOnNodeJoining(DistributionInfoData distInfoData)
        {
            if (NCacheLog.IsInfoEnabled)
            {
                NCacheLog.Info("DistributionMgr.GetMapsOnNodeJoining()", "Total Data Size : " + TotalDataSize.ToString());
            }
            ArrayList tmpMap = null;
            Hashtable bucketsOwnershipMap = null;
            ArrayList partitionNodes      = new ArrayList();

            ArrayList newHashMap = DistributeHashMap.BalanceBuckets(distInfoData, _lastCreatedHashMap, _bucketsStats, _existingMembers, _cacheSizePerNode, NCacheLog);

            _existingMembers.Add(distInfoData.AffectedNode.NodeAddress);

            tmpMap = ChangeOwnerShip(newHashMap, distInfoData.AffectedNode.NodeAddress);

            _lastCreatedHashMap = tmpMap.Clone() as ArrayList;

            bucketsOwnershipMap = GetBucketsOwnershipMap(_lastCreatedHashMap);
            if (NCacheLog.IsInfoEnabled)
            {
                NCacheLog.Info("DistributionMgr.GetMaps()", "Sending new map as a new node joined the cluster");
            }
            return(new DistributionMaps(_lastCreatedHashMap, bucketsOwnershipMap));
        }
Beispiel #2
0
        protected DistributionMaps GetMapsOnNodeLeaving(DistributionInfoData distInfoData)
        {
            ArrayList tmpMap = null;
            Hashtable bucketsOwnershipMap = null;

            _existingMembers.Remove(distInfoData.AffectedNode.NodeAddress);
            if (NCacheLog.IsInfoEnabled)
            {
                NCacheLog.Info("DistributionMgr.GetMapsOnNodeLeaving()", "Before Calling DistributeOrphanBuckets() ---- Leaving Node:" + distInfoData.AffectedNode.NodeAddress.ToString() + " Existing Members Count:0" + _existingMembers.Count);
            }
            tmpMap = DistributeHashMap.DistributeOrphanBuckets(_lastCreatedHashMap, distInfoData.AffectedNode.NodeAddress, _existingMembers);

            if (tmpMap == null)
            {
                return(null);
            }
            _lastCreatedHashMap = tmpMap.Clone() as ArrayList;

            bucketsOwnershipMap = GetBucketsOwnershipMap(_lastCreatedHashMap);
            return(new DistributionMaps(_lastCreatedHashMap, bucketsOwnershipMap));
        }