Exemple #1
0
        public void Initialize(EnumerationPointer pointer, IndexedLocalCache cache)
        {
            _cache   = cache;
            _pointer = pointer;

            _snapshot = CacheSnapshotPool.Instance.GetSnaphot(pointer.Id, cache);
        }
Exemple #2
0
        internal EnumerationDataChunk GetNextChunk(EnumerationPointer pointer)
        {
            EnumerationDataChunk nextChunk = null;
            IEnumerationProvider provider  = GetProvider(pointer);

            if (pointer.isDisposable && provider != null)
            {
                provider.Dispose();
                if (_index.ContainsKey(pointer))
                {
                    _index.Remove(pointer);
                }
                nextChunk         = new EnumerationDataChunk();
                nextChunk.Pointer = pointer;
            }
            else if (provider != null)
            {
                nextChunk = provider.GetNextChunk(pointer);
                //Dispose the provider if this is the last chunk for it
                if (nextChunk.IsLastChunk)
                {
                    provider.Dispose();
                    if (_index.ContainsKey(pointer))
                    {
                        _index.Remove(pointer);
                    }
                }
            }

            return(nextChunk);
        }
Exemple #3
0
 public void Dispose()
 {
     CacheSnapshotPool.Instance.DiposeSnapshot(_pointer.Id, _cache); //Disposes the snapshot from pool for this particular pointer
     _cache    = null;
     _pointer  = null;
     _snapshot = null;
 }
Exemple #4
0
        internal GetNextChunkCommand(EnumerationPointer pointer)
        {
            base.name = "GetNextChunkCommand";

            _getNextChunkCommand = new Alachisoft.NCache.Common.Protobuf.GetNextChunkCommand();
            _getNextChunkCommand.enumerationPointer = EnumerationPointerConversionUtil.ConvertToProtobufEnumerationPointer(pointer);
        }
Exemple #5
0
 public override EnumerationDataChunk GetNextChunk(EnumerationPointer pointer, OperationContext operationContext)
 {
     if (_enumerationIndex == null)
     {
         _enumerationIndex = new EnumerationIndex(this);
     }
     return(_enumerationIndex.GetNextChunk(pointer));
 }
Exemple #6
0
 public override bool HasEnumerationPointer(EnumerationPointer pointer)
 {
     if (_enumerationIndex == null)
     {
         return(false);
     }
     return(_enumerationIndex.Contains(pointer));
 }
Exemple #7
0
 public void DisposeEnumerator(EnumerationPointer pointer)
 {
     if (_cache != null)
     {
         //Just a dummy call to dispose enumerator
         pointer.isDisposable          = true;
         pointer.IsSocketServerDispose = true;
         _cache.GetNextChunk(pointer, new OperationContext());
     }
 }
Exemple #8
0
 public void Initialize(EnumerationPointer pointer, IndexedLocalCache cache)
 {
     _cache   = cache;
     _pointer = pointer;
     if (System.Configuration.ConfigurationSettings.AppSettings.Get("NCacheServer.EnumeratorChunkSize") != null)
     {
         _chunkSize = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings.Get("NCacheServer.EnumeratorChunkSize"));
     }
     _snapshot = CacheSnapshotPool.Instance.GetSnaphot(pointer.Id, cache);
 }
Exemple #9
0
 internal bool Contains(EnumerationPointer pointer)
 {
     if (_index != null)
     {
         return(_index.ContainsKey(pointer));
     }
     else
     {
         return(false);
     }
 }
 public override EnumerationDataChunk GetNextChunk(EnumerationPointer pointer, OperationContext operationContext)
 {
     base.Sync.AcquireWriterLock(-1);
     try
     {
         return(this.Internal.GetNextChunk(pointer, operationContext));
     }
     finally
     {
         base.Sync.ReleaseWriterLock();
     }
 }
 public override bool HasEnumerationPointer(EnumerationPointer pointer)
 {
     base.Sync.AcquireWriterLock(-1);
     try
     {
         return(this.Internal.HasEnumerationPointer(pointer));
     }
     finally
     {
         base.Sync.ReleaseWriterLock();
     }
 }
Exemple #12
0
 protected void Clustered_GetNextChunk(ArrayList dests, EnumerationPointer pointer, OperationContext operationContext)
 {
     try
     {
         Function func    = new Function((int)OpCodes.GetNextChunk, new object[] { pointer, operationContext }, true);
         RspList  results = Cluster.BroadcastToMultiple(dests, func, GroupRequest.GET_ALL, false);
         ClusterHelper.ValidateResponses(results, null, Name);
     }
     catch (CacheException e)
     {
         throw;
     }
     catch (Exception e)
     {
         throw new GeneralFailureException(e.Message, e);
     }
 }
Exemple #13
0
        public void Initialize(string group, string subGroup)
        {
            EnumerationPointer pointer = null;

            if (!String.IsNullOrEmpty(group))
            {
                pointer = new GroupEnumerationPointer(group, subGroup);
            }
            else
            {
                pointer = new EnumerationPointer();
            }

            _currentChunk = _cache.GetNextChunk(pointer, new OperationContext());

            if (_currentChunk != null && _currentChunk.Data != null)
            {
                List <string> data = _currentChunk.Data;
                _currentChunkEnumerator = data.GetEnumerator();
            }
        }
Exemple #14
0
        private IEnumerationProvider GetProvider(EnumerationPointer pointer)
        {
            if (_index == null)
            {
                _index = new Dictionary <EnumerationPointer, IEnumerationProvider>();
            }

            IEnumerationProvider provider = null;

            if (_index.ContainsKey(pointer))
            {
                provider = _index[pointer];
            }
            else if (pointer.ChunkId == -1 && !pointer.IsSocketServerDispose && !pointer.isDisposable)
            {
                provider = new SnapshotEnumerationProvider();
                provider.Initialize(pointer, _cache);
                _index.Add(pointer, provider);
            }

            return(provider);
        }
Exemple #15
0
 public virtual bool HasEnumerationPointer(EnumerationPointer pointer)
 {
     return(false);
 }
Exemple #16
0
 public override EnumerationDataChunk GetNextChunk(EnumerationPointer pointer, OperationContext operationContext)
 {
     return(Internal.GetNextChunk(pointer, operationContext));
 }
Exemple #17
0
 public virtual EnumerationDataChunk GetNextChunk(EnumerationPointer pointer)
 {
     return(null);
 }
Exemple #18
0
 public void Initialize(EnumerationPointer pointer, LocalCache cache)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Exemple #19
0
 public EnumerationDataChunk GetNextChunk(EnumerationPointer pointer)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Exemple #20
0
 public virtual EnumerationDataChunk GetNextChunk(EnumerationPointer pointer, OperationContext operationContext)
 {
     return(null);
 }