Exemplo n.º 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)
            {
                MirrorCacheBase cache = _cache as MirrorCacheBase;

                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);
            }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="keyList"></param>
 public ClusteredEnumerator(MirrorCacheBase cache, Address address, object[] keyList, bool isUserOperation)
     : base(cache, keyList, true)
 {
     _targetNode      = address;
     _isUserOperation = isUserOperation;
 }