Package cs1302.tracer.batch
Class BatchTraceService
java.lang.Object
cs1302.tracer.batch.BatchTraceService
- All Implemented Interfaces:
AutoCloseable
Service managing pool of batch trace workers and streaming NDJSON requests/responses.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum allowed characters in a single NDJSON input record (16 MB). -
Constructor Summary
ConstructorsConstructorDescriptionBatchTraceService(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 TypeMethodDescriptionvoidclose()voidprocessStream(InputStream input, Writer output) Processes an NDJSON input stream and writes NDJSON responses to writer.
-
Field Details
-
MAX_RECORD_CHARS
public static final int MAX_RECORD_CHARSMaximum 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
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:
closein interfaceAutoCloseable
-