Class TextBatchTaskSummaryWriter

java.lang.Object
ubic.gemma.cli.batch.TextBatchTaskSummaryWriter
All Implemented Interfaces:
Closeable, AutoCloseable, BatchTaskSummaryWriter

public class TextBatchTaskSummaryWriter extends Object implements BatchTaskSummaryWriter
Author:
poirigui
  • Constructor Details

    • TextBatchTaskSummaryWriter

      public TextBatchTaskSummaryWriter(Appendable dest)
  • Method Details

    • write

      public void write(BatchTaskProcessingResult result) throws IOException
      Record the result for the grouped summary, and emit it immediately.

      🛑 The grouped summary can only be written at close() — it counts and sections the results, so it cannot exist until they all do. That made this writer the one format whose entire record lived in memory until the end of the run, which was survivable only as long as the JVM always reached the end. It no longer does: the CLI runs with -XX:+ExitOnOutOfMemoryError, and that calls os::exit() — no close(), no shutdown hook, nothing. A sweep that OOM'd on item 7 of 22 would have lost the record of the six that succeeded, which is worse than the hung JVM the flag was added to prevent.

      TEXT is the default format (anything without -batchOutputFile), so this was the default exposure. TSV never had it — TsvBatchTaskSummaryWriter flushes each row as it is printed.

      The per-result line is the same formatResult(BatchTaskProcessingResult) the summary uses, so the two agree; the summary still follows at close with the counts and the grouping.

      Specified by:
      write in interface BatchTaskSummaryWriter
      Throws:
      IOException
    • close

      public void close() throws IOException
      Description copied from interface: BatchTaskSummaryWriter
      Close the writer and write any remaining results.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface BatchTaskSummaryWriter
      Specified by:
      close in interface Closeable
      Throws:
      IOException