private CacheInsResultWithEntry Safe_Clustered_Insert(object key, CacheEntry cacheEntry, out Address targetNode, object lockId, LockAccessType accessType, OperationContext operationContext)
        {
            bool suspectedErrorOccured = false;
            int maxTries = _stats.Nodes.Count > 3 ? 3 : _stats.Nodes.Count - 1;
            CacheInsResultWithEntry retVal = new CacheInsResultWithEntry();
            targetNode = null;
            do
            {
                try
                {
                    targetNode = GetNextNode(key as string);

                    if (targetNode == null)
                    {
                        throw new Exception("No target node available to accommodate the data.");
                    }

                    if (targetNode.CompareTo(LocalAddress) == 0)
                    {
                        retVal = Local_Insert(key, cacheEntry, Cluster.LocalAddress, true, lockId, accessType,
                            operationContext);
                    }
                    else
                    {
                        retVal = Clustered_Insert(targetNode, key, cacheEntry, lockId, accessType,
                            operationContext);
                    }

                    break;
                }
                catch (Alachisoft.NCache.Caching.Exceptions.StateTransferException se)
                {
                    _distributionMgr.Wait(key);
                }
                catch (Runtime.Exceptions.TimeoutException te)
                {
                    if (NCacheLog.IsInfoEnabled)
                        NCacheLog.Info("PartitionedCache.Safe_Clustered_Insert()", te.ToString());
                    if (suspectedErrorOccured)
                    {
                        suspectedErrorOccured = false;
                        continue;
                    }
                    else
                        throw;
                }
                catch (Runtime.Exceptions.SuspectedException e)
                {
                    suspectedErrorOccured = true;
                    if (NCacheLog.IsInfoEnabled)
                        NCacheLog.Info("PartitionedCache.Safe_Clustered_Insert()", e.ToString());
                    if (maxTries == 0)
                        throw;
                    maxTries--;
                }
            } while (maxTries > 0);
            return retVal;
        }
        /// <summary>
        /// A wrapper method that reperform the operations that fail because
        /// of the members suspected during operations.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="cacheEntry"></param>
        /// <param name="targetNode"></param>
        /// <param name="operationContext"></param>
        /// <returns></returns>
        private CacheAddResult Safe_Clustered_Add(object key, CacheEntry cacheEntry, out Address targetNode, OperationContext operationContext)
        {
            bool suspectedErrorOccured = false;
            int maxTries = _stats.Nodes.Count > 3 ? 3 : _stats.Nodes.Count - 1;
            CacheAddResult result = CacheAddResult.Failure;
            targetNode = null;
            do
            {

                try
                {
                    targetNode = GetNextNode(key as string);

                    
                    //possible in case of strict affinity...
                    if (targetNode == null)
                    {
                        throw new Exception("No target node available to accommodate the data.");
                    }

                    if (targetNode.CompareTo(LocalAddress) == 0)
                    {
                        result = Local_Add(key, cacheEntry, Cluster.LocalAddress, true, operationContext);
                    }
                    else
                    {
                        result = Clustered_Add(targetNode, key, cacheEntry, operationContext);
                    }
                    return result;
                }
                catch (Alachisoft.NCache.Caching.Exceptions.StateTransferException se)
                {
                    _distributionMgr.Wait(key);
                }
                catch (Runtime.Exceptions.TimeoutException te)
                {
                    if (NCacheLog.IsInfoEnabled) NCacheLog.Info("PartitionedCache.Clustered_Add()", te.ToString());
                    if (suspectedErrorOccured)
                    {
                        suspectedErrorOccured = false;
                        continue;
                    }
                    else
                        throw;
                }
                catch (Runtime.Exceptions.SuspectedException e)
                {
                    suspectedErrorOccured = true;
                    if (NCacheLog.IsInfoEnabled) NCacheLog.Info("PartitionedCache.Clustered_Add()", e.ToString());
                    if (maxTries == 0)
                        throw;
                    maxTries--;
                }
            } while (maxTries > 0);
            return result;
        }