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);
}
}