예제 #1
0
            /// <summary>
            /// Does the lazy loading of object. This method is virtual so containers can
            /// customize object fetching logic.
            /// </summary>
            /// <param name="key"></param>
            /// <returns></returns>
            protected override object FetchObject(object key, OperationContext operationContext)
            {
                ReplicatedCacheBase cache = _cache as ReplicatedCacheBase;

                object obj     = null;
                bool   doAgain = false;


                do
                {
                    doAgain = false;
                    Address targetNode = cache.Cluster.Coordinator;
                    if (targetNode == null)
                    {
                        return(null);
                    }

                    if (cache.Cluster.IsCoordinator)
                    {
                        //coordinator has left and i am the new coordinator so need not to do
                        //state transfer.
                        _bvalid = false;
                        return(obj);
                    }
                    try
                    {
                        operationContext.Add(OperationContextFieldName.GenerateQueryInfo, true);
                        obj = cache.Clustered_Get(targetNode, key, operationContext, _isUserOperation);
                    }
                    catch (Runtime.Exceptions.SuspectedException se)
                    {
                        //coordinator has left; so need to synchronize with the new coordinator.
                        doAgain = true;
                    }
                }while (doAgain);

                return(obj);
            }
예제 #2
0
 /// <summary>
 /// Constructor 
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="keyList"></param>
 public ClusteredEnumerator(ReplicatedCacheBase cache, Address address, object[] keyList, bool isUserOperation)
     : base(cache, keyList, true)
 {
     _targetNode = address; 
     _isUserOperation = isUserOperation;
 }
예제 #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="keyList"></param>
 public ClusteredEnumerator(ReplicatedCacheBase cache, Address address, object[] keyList, bool isUserOperation)
     : base(cache, keyList, true)
 {
     _targetNode      = address;
     _isUserOperation = isUserOperation;
 }