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