Lucene.Net.Store.MockRAMDirectory.GetRecomputedSizeInBytes C# (CSharp) 메소드

GetRecomputedSizeInBytes() 공개 메소드

public GetRecomputedSizeInBytes ( ) : long
리턴 long
        public long GetRecomputedSizeInBytes()
        {
            lock (this)
            {
                long size = 0;
                foreach(RAMFile file in fileMap.Values)
                    size += file.SizeInBytes;
                return size;
            }
        }

Usage Example

예제 #1
0
        public virtual void  TestRAMDirectorySize()
        {
            MockRAMDirectory ramDir = new MockRAMDirectory(indexDir.FullName);
            IndexWriter      writer = new IndexWriter(ramDir, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED);

            writer.Optimize();

            Assert.AreEqual(ramDir.SizeInBytes(), ramDir.GetRecomputedSizeInBytes());

            SupportClass.ThreadClass[] threads = new SupportClass.ThreadClass[numThreads];
            for (int i = 0; i < numThreads; i++)
            {
                int num = i;
                threads[i] = new AnonymousClassThread(num, writer, ramDir, this);
            }
            for (int i = 0; i < numThreads; i++)
            {
                threads[i].Start();
            }
            for (int i = 0; i < numThreads; i++)
            {
                threads[i].Join();
            }

            writer.Optimize();
            Assert.AreEqual(ramDir.SizeInBytes(), ramDir.GetRecomputedSizeInBytes());

            writer.Close();
        }
All Usage Examples Of Lucene.Net.Store.MockRAMDirectory::GetRecomputedSizeInBytes