RamSizeInBytes() public method

Expert: Return the total size of all index files currently cached in memory. Useful for size management with flushRamDocs()
public RamSizeInBytes ( ) : long
return long
Beispiel #1
0
 public override void Run()
 {
     try
     {
         long ramSize = 0;
         while (PendingDocs.DecrementAndGet() > -1)
         {
             Document doc = Docs.NextDoc();
             Writer.AddDocument(doc);
             long newRamSize = Writer.RamSizeInBytes();
             if (newRamSize != ramSize)
             {
                 ramSize = newRamSize;
             }
             if (DoRandomCommit)
             {
                 if (Rarely())
                 {
                     Writer.Commit();
                 }
             }
         }
         Writer.Commit();
     }
     catch (Exception ex)
     {
         Console.WriteLine("FAILED exc:");
         Console.WriteLine(ex.StackTrace);
         throw new Exception(ex.Message, ex);
     }
 }
Beispiel #2
0
 public override void Run()
 {
     try
     {
         long ramSize = 0;
         while (pendingDocs.DecrementAndGet() > -1)
         {
             Document doc = docs.NextDoc();
             writer.AddDocument(doc);
             long newRamSize = writer.RamSizeInBytes();
             if (newRamSize != ramSize)
             {
                 ramSize = newRamSize;
             }
             if (doRandomCommit)
             {
                 if (Rarely())
                 {
                     writer.Commit();
                 }
             }
         }
         writer.Commit();
     }
     catch (Exception ex) when(ex.IsThrowable())
     {
         Console.WriteLine("FAILED exc:");
         ex.printStackTrace(Console.Out);
         throw RuntimeException.Create(ex);
     }
 }