Class BatchTraceService

java.lang.Object
cs1302.tracer.batch.BatchTraceService
All Implemented Interfaces:
AutoCloseable

public final class BatchTraceService extends Object implements AutoCloseable
Service managing pool of batch trace workers and streaming NDJSON requests/responses.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Maximum allowed characters in a single NDJSON input record (16 MB).
  • Constructor Summary

    Constructors
    Constructor
    Description
    BatchTraceService(int workerCount, int maxJobsPerWorker)
    Constructs a batch trace service with specified concurrency and recycling limits.
    BatchTraceService(int workerCount, int maxJobsPerWorker, int maxInFlight, boolean completionOrder)
    Constructs a bounded batch scheduler with explicit output ordering.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    Processes an NDJSON input stream and writes NDJSON responses to writer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MAX_RECORD_CHARS

      public static final int MAX_RECORD_CHARS
      Maximum allowed characters in a single NDJSON input record (16 MB).
      See Also:
  • Constructor Details

    • BatchTraceService

      public BatchTraceService(int workerCount, int maxJobsPerWorker)
      Constructs a batch trace service with specified concurrency and recycling limits.
      Parameters:
      workerCount - Number of concurrent worker sessions.
      maxJobsPerWorker - Maximum jobs before recycling a worker.
    • BatchTraceService

      public BatchTraceService(int workerCount, int maxJobsPerWorker, int maxInFlight, boolean completionOrder)
      Constructs a bounded batch scheduler with explicit output ordering.
      Parameters:
      workerCount - Concurrent guests.
      maxJobsPerWorker - Jobs before recycling a reusable guest.
      maxInFlight - Maximum admitted jobs, including buffered results.
      completionOrder - Emit responses immediately as jobs finish.
  • Method Details

    • processStream

      public void processStream(InputStream input, Writer output) throws IOException
      Processes an NDJSON input stream and writes NDJSON responses to writer.
      Parameters:
      input - Input stream containing NDJSON lines.
      output - Output writer for response NDJSON lines.
      Throws:
      IOException - On stream IO failure.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable