Example #1
0
        public object Clone()
        {
            NonShardedDistribution clone = new NonShardedDistribution();

            clone._bucket = _bucket != null?_bucket.Clone() as HashMapBucket : null;

            clone._distributionSequence = _distributionSequence;
            clone._name = _name;

            return(clone);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public virtual Hashtable GetBucketsOwnershipMap(ArrayList hashMap)
        {
            Hashtable bucketsOwnershipMap = new Hashtable();

            _sync.AcquireReaderLock(Timeout.Infinite);
            try
            {
                if (hashMap != null)
                {
                    IEnumerator ie = hashMap.GetEnumerator();
                    while (ie.MoveNext())
                    {
                        HashMapBucket bucket = ie.Current as HashMapBucket;

                        Address owner = bucket.TempAddress != null ? bucket.TempAddress : bucket.PermanentAddress;

                        if (bucketsOwnershipMap.Contains(owner))
                        {
                            ArrayList buckets = bucketsOwnershipMap[owner] as ArrayList;
                            if (!buckets.Contains(bucket))
                            {
                                buckets.Add(bucket.Clone());
                            }
                        }
                        else
                        {
                            ArrayList buckets = new ArrayList();
                            buckets.Add(bucket.Clone());
                            bucketsOwnershipMap[owner] = buckets;
                        }
                    }
                }
            }
            finally
            {
                _sync.ReleaseReaderLock();
            }
            return(bucketsOwnershipMap);
        }