Package io.sbk.api

Class AbstractCallbackReader<T>

java.lang.Object
io.sbk.api.AbstractCallbackReader<T>
All Implemented Interfaces:
DataReader<T>

public abstract non-sealed class AbstractCallbackReader<T> extends Object implements DataReader<T>
Abstract class for Callback Reader.
  • Constructor Details

    • AbstractCallbackReader

      public AbstractCallbackReader()
  • Method Details

    • start

      public abstract void start(Callback<T> callback) throws IOException
      set the Callback and start the CallBack Reader.
      Parameters:
      callback - Reader callback.
      Throws:
      IOException - If an exception occurred.
    • stop

      public abstract void stop() throws IOException
      Stop the CallBack Reader.
      Throws:
      IOException - If an exception occurred.
    • close

      public final void close() throws IOException
      Close the CallBack Reader. stops the callback reader.
      Specified by:
      close in interface DataReader<T>
      Throws:
      IOException - If an exception occurred.
    • recordBenchmark

      public void recordBenchmark(long startTime, long endTime, int dataSize, int events)
      Keeps record of Benchmark if record gets completed it call complete function.
      Parameters:
      startTime - long
      endTime - long
      dataSize - int
      events - int
    • initialize

      public void initialize(Worker reader, long secondsToRun, long recordsCount, DataType<T> dType, io.time.Time time, Callback<T> callback) throws IOException
      Default Implementation to initialize the callback reader.
      Parameters:
      reader - Reader Descriptor
      secondsToRun - Number of seconds to run
      recordsCount - Records count
      dType - dataType
      time - time interface
      callback - Callback interface
      Throws:
      IOException - If an exception occurred.
    • complete

      public void complete()
      Default Implementation complete the read.
    • waitToComplete

      public void waitToComplete() throws IOException
      Default Implementation to wait for the readers to complete.
      Throws:
      IOException - If an exception occurred.
    • run

      public void run(Worker reader, long secondsToRun, long recordsCount, DataType<T> dType, io.time.Time time, Callback<T> callback) throws IOException
      Default Implementation run the Benchmark.
      Parameters:
      reader - Reader Descriptor
      secondsToRun - Number of seconds to run
      recordsCount - Records count
      dType - dataType
      time - time interface
      callback - Callback interface
      Throws:
      IOException - If an exception occurred.
    • RecordsReader

      public void RecordsReader(Worker reader, long recordsCount, DataType<T> dType, io.time.Time time) throws EOFException, IOException
      Implementation for benchmarking reader by reading given number of records.
      Specified by:
      RecordsReader in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      recordsCount - Records count
      dType - dataType
      time - time interface
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsReader

      public void RecordsReader(Worker reader, long recordsCount, DataType<T> dType, io.time.Time time, ReadRequestsLogger logger) throws EOFException, IOException
      Implementation for benchmarking reader by reading given number of records.
      Specified by:
      RecordsReader in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      recordsCount - Records count
      dType - dataType
      time - time interface
      logger - log read requests
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsReaderRW

      public void RecordsReaderRW(Worker reader, long recordsCount, DataType<T> dType, io.time.Time time) throws EOFException, IOException
      Default implementation for benchmarking reader by reading given number of records.
      Specified by:
      RecordsReaderRW in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      recordsCount - Records count
      dType - dataType
      time - time interface
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsReaderRW

      public void RecordsReaderRW(Worker reader, long recordsCount, DataType<T> dType, io.time.Time time, ReadRequestsLogger logger) throws EOFException, IOException
      Default implementation for benchmarking reader by reading given number of records.
      Specified by:
      RecordsReaderRW in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      recordsCount - Records count
      dType - dataType
      time - time interface
      logger - log read requests
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsTimeReader

      public void RecordsTimeReader(Worker reader, long secondsToRun, DataType<T> dType, io.time.Time time) throws EOFException, IOException
      Default implementation for benchmarking reader by reading events/records for specific time duration.
      Specified by:
      RecordsTimeReader in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      secondsToRun - Number of seconds to run
      dType - dataType
      time - time interface
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsTimeReader

      public void RecordsTimeReader(Worker reader, long secondsToRun, DataType<T> dType, io.time.Time time, ReadRequestsLogger logger) throws EOFException, IOException
      Default implementation for benchmarking reader by reading events/records for specific time duration.
      Specified by:
      RecordsTimeReader in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      secondsToRun - Number of seconds to run
      dType - dataType
      time - time interface
      logger - log read requests
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsTimeReaderRW

      public void RecordsTimeReaderRW(Worker reader, long secondsToRun, DataType<T> dType, io.time.Time time) throws EOFException, IOException
      Default implementation for benchmarking reader by reading events/records for specific time duration.
      Specified by:
      RecordsTimeReaderRW in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      secondsToRun - Number of seconds to run
      dType - dataType
      time - time interface
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsTimeReaderRW

      public void RecordsTimeReaderRW(Worker reader, long secondsToRun, DataType<T> dType, io.time.Time time, ReadRequestsLogger logger) throws EOFException, IOException
      Default implementation for benchmarking reader by reading events/records for specific time duration.
      Specified by:
      RecordsTimeReaderRW in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      secondsToRun - Number of seconds to run
      dType - dataType
      time - time interface
      logger - log read requests
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsReaderRateControl

      public void RecordsReaderRateControl(Worker reader, long recordsCount, DataType<T> dType, io.time.Time time, RateController rController) throws EOFException, IOException
      Benchmarking reader by reading given number of records with Rate controlled.
      Specified by:
      RecordsReaderRateControl in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      recordsCount - Records count
      dType - dataType
      time - time interface
      rController - Rate Controller
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsReaderRateControl

      public void RecordsReaderRateControl(Worker reader, long recordsCount, DataType<T> dType, io.time.Time time, RateController rController, ReadRequestsLogger logger) throws EOFException, IOException
      Benchmarking reader by reading given number of records with Rate controlled.
      Specified by:
      RecordsReaderRateControl in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      recordsCount - Records count
      dType - dataType
      time - time interface
      rController - Rate Controller
      logger - log read requests
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsReaderRWRateControl

      public void RecordsReaderRWRateControl(Worker reader, long recordsCount, DataType<T> dType, io.time.Time time, RateController rController) throws EOFException, IOException
      Benchmarking reader by reading given number of records with Rate controlled. used while another writer is writing the data.
      Specified by:
      RecordsReaderRWRateControl in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      recordsCount - Records count
      dType - dataType
      time - time interface
      rController - Rate Controller
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsReaderRWRateControl

      public void RecordsReaderRWRateControl(Worker reader, long recordsCount, DataType<T> dType, io.time.Time time, RateController rController, ReadRequestsLogger logger) throws EOFException, IOException
      Benchmarking reader by reading given number of records with Rate controlled. used while another writer is writing the data.
      Specified by:
      RecordsReaderRWRateControl in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      recordsCount - Records count
      dType - dataType
      time - time interface
      rController - Rate Controller
      logger - log read requests
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsTimeReaderRateControl

      public void RecordsTimeReaderRateControl(Worker reader, long secondsToRun, DataType<T> dType, io.time.Time time, RateController rController) throws EOFException, IOException
      Benchmarking reader by reading events/records for specific time duration with Rate controlled.
      Specified by:
      RecordsTimeReaderRateControl in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      secondsToRun - Number of seconds to run
      dType - dataType
      time - time interface
      rController - Rate Controller
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsTimeReaderRateControl

      public void RecordsTimeReaderRateControl(Worker reader, long secondsToRun, DataType<T> dType, io.time.Time time, RateController rController, ReadRequestsLogger logger) throws EOFException, IOException
      Benchmarking reader by reading events/records for specific time duration with Rate controlled.
      Specified by:
      RecordsTimeReaderRateControl in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      secondsToRun - Number of seconds to run
      dType - dataType
      time - time interface
      rController - Rate Controller
      logger - log read requests
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsTimeReaderRWRateControl

      public void RecordsTimeReaderRWRateControl(Worker reader, long secondsToRun, DataType<T> dType, io.time.Time time, RateController rController) throws EOFException, IOException
      Benchmarking reader by reading events/records for specific time duration with Rate controlled. used while another writer is writing the data.
      Specified by:
      RecordsTimeReaderRWRateControl in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      secondsToRun - Number of seconds to run
      dType - dataType
      time - time interface
      rController - Rate Controller
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • RecordsTimeReaderRWRateControl

      public void RecordsTimeReaderRWRateControl(Worker reader, long secondsToRun, DataType<T> dType, io.time.Time time, RateController rController, ReadRequestsLogger logger) throws EOFException, IOException
      Benchmarking reader by reading events/records for specific time duration with Rate controlled. used while another writer is writing the data.
      Specified by:
      RecordsTimeReaderRWRateControl in interface DataReader<T>
      Parameters:
      reader - Reader Descriptor
      secondsToRun - Number of seconds to run
      dType - dataType
      time - time interface
      rController - Rate Controller
      logger - log read requests
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.