Class AbstractTaskGenerator

    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • startTaskGenMutex

        private Semaphore startTaskGenMutex
        Mutex used to wait for the start signal after the component has been started and initialized.
      • terminateMutex

        private Semaphore terminateMutex
        Mutex used to wait for the terminate signal.
      • generatorId

        private int generatorId
        The id of this generator.
      • numberOfGenerators

        private int numberOfGenerators
        The number of task generators created by the benchmark controller.
      • nextTaskId

        private long nextTaskId
        The task id that will be assigned to the next task generated by this generator.
      • maxParallelProcessedMsgs

        private final int maxParallelProcessedMsgs
        The maximum number of incoming messages that are processed in parallel. Additional messages have to wait.
      • sender2System

        protected DataSender sender2System
      • sender2EvalStore

        protected DataSender sender2EvalStore
      • consumer

        protected com.rabbitmq.client.QueueingConsumer consumer
      • runFlag

        protected boolean runFlag
    • Constructor Detail

      • AbstractTaskGenerator

        public AbstractTaskGenerator​(int maxParallelProcessedMsgs)
        Constructor setting the maximum number of parallel processed messages. Note that this parameter has to be larger or equal to 1 or the init() method will throw an exception. Setting maxParallelProcessedMsgs=1 leads to the usage of a QueueingConsumer.
        Parameters:
        maxParallelProcessedMsgs - the number of messaegs that are processed in parallel
    • Method Detail

      • run

        public void run()
                 throws Exception
        Description copied from interface: Component
        This method executes the component.
        Specified by:
        run in interface Component
        Throws:
        Exception - if an error occurs during the execution
      • generateTask

        protected abstract void generateTask​(byte[] data)
                                      throws Exception
        Generates a task from the given data, sends it to the system, takes the timestamp of the moment at which the message has been sent to the system and sends it together with the expected response to the evaluation storage.
        Parameters:
        data - incoming data generated by a data generator
        Throws:
        Exception - if a sever error occurred
      • getNextTaskId

        protected String getNextTaskId()
        Generates the next unique ID for a task.
        Returns:
        the next unique task ID
      • sendTaskToEvalStorage

        protected void sendTaskToEvalStorage​(String taskIdString,
                                             long timestamp,
                                             byte[] data)
                                      throws IOException
        This method sends the given data and the given timestamp of the task with the given task id to the evaluation storage.
        Parameters:
        taskIdString - the id of the task
        timestamp - the timestamp of the moment in which the task has been sent to the system
        data - the expected response for the task with the given id
        Throws:
        IOException - if there is an error during the sending
      • sendTaskToSystemAdapter

        protected void sendTaskToSystemAdapter​(String taskIdString,
                                               byte[] data)
                                        throws IOException
        Sends the given task with the given task id and data to the system.
        Parameters:
        taskIdString - the id of the task
        data - the data of the task
        Throws:
        IOException - if there is an error during the sending
      • getGeneratorId

        public int getGeneratorId()
      • getNumberOfGenerators

        public int getNumberOfGenerators()