Class Worker

java.lang.Object
io.sbk.api.Worker
Direct Known Subclasses:
SbkCallbackReader, SbkReader, SbkWriter

public abstract class Worker extends Object
Abstract class for Writers and Readers.

This small immutable holder provides per-worker context that is shared with driver implementations for both readers and writers. It centralises three commonly used pieces of information:

  • id - the worker identifier (0-based) used for request logging and per-worker statistics.
  • params - the parsed benchmark parameters that control run behaviour (counts, rates, sizes, etc.).
  • perlChannel - optional PerL channel used to emit timing and throughput events to the metrics/collector subsystem.

Implementation notes and guidelines:

  • The fields are intentionally final to make the Worker instance immutable after construction; driver code may safely read these values concurrently without additional synchronization.
  • Do not add driver-specific mutable state to this class; instead keep per-worker state inside the driver implementation to avoid accidental sharing between workers.
  • Construct Worker instances using the worker id assigned by the harness (writers/readers are created by SbkBenchmark).
  • Field Details

    • id

      public final int id
    • params

      public final Parameters params
    • perlChannel

      public final io.perl.api.PerlChannel perlChannel
  • Constructor Details

    • Worker

      public Worker(int workerID, Parameters params, io.perl.api.PerlChannel perlChannel)