Class AbstractWorker

  • All Implemented Interfaces:
    java.lang.Runnable, Worker
    Direct Known Subclasses:
    AbstractRandomQueryChooserWorker

    public abstract class AbstractWorker
    extends java.lang.Object
    implements Worker
    The Abstract Worker which will implement the runnable, the main loop, the time to wait before a query and will send the results to the ResultProcessor module
    so the Implemented Workers only need to implement which query to test next and how to test this query.
    Author:
    f.conrads
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractWorker​(java.lang.String taskID, Connection connection, java.lang.String queriesFile, java.lang.Integer timeOut, java.lang.Integer timeLimit, java.lang.Integer fixedLatency, java.lang.Integer gaussianLatency, java.lang.String workerType, java.lang.Integer workerID)  
    • Constructor Detail

      • AbstractWorker

        public AbstractWorker​(java.lang.String taskID,
                              Connection connection,
                              java.lang.String queriesFile,
                              @Nullable
                              java.lang.Integer timeOut,
                              @Nullable
                              java.lang.Integer timeLimit,
                              @Nullable
                              java.lang.Integer fixedLatency,
                              @Nullable
                              java.lang.Integer gaussianLatency,
                              java.lang.String workerType,
                              java.lang.Integer workerID)
    • Method Detail

      • waitTimeMs

        public void waitTimeMs()
        Description copied from interface: Worker
        This will simulate the Time in ms to wait before testing the next query. It can be used to simulate network delay.
        Specified by:
        waitTimeMs in interface Worker
      • startWorker

        public void startWorker()
        This will start the worker. It will get the next query, wait as long as it should wait before executing the next query, then it will test the query and send it if not aborted yet to the ResultProcessor Module
      • popQueryResults

        public java.util.Collection<java.util.Properties> popQueryResults()
        Description copied from interface: Worker
        Get and remove all internal stored results of finished queries
        Specified by:
        popQueryResults in interface Worker
        Returns:
        list of Properties to send to RabbitMQ
      • getExecutedQueries

        public long getExecutedQueries()
        Description copied from interface: Worker
        This will return the amount of executed queries so far
        Specified by:
        getExecutedQueries in interface Worker
        Returns:
        no. of executed queries
      • stopSending

        public void stopSending()
        Description copied from interface: Worker
        This should stop the next sending process. If an execution started before this method was called, but answered after, it should not be counted!
        Specified by:
        stopSending in interface Worker
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface Worker
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • getQueriesFileName

        public java.lang.String getQueriesFileName()
        Returns the name of the queries file name/update path
        Returns:
        file name/update path
      • setQueriesList

        public void setQueriesList​(java.io.File[] queries)
        Sets the Query Instances repr. in Files.
        Parameters:
        queries - File containing the query instances.
      • getNoOfQueries

        public long getNoOfQueries()
        The number of Queries in one mix
        Specified by:
        getNoOfQueries in interface Worker
        Returns:
      • hasExecutedNoOfQueryMixes

        public boolean hasExecutedNoOfQueryMixes​(double noOfQueryMixes)
        Description copied from interface: Worker
        Returns if the no of query mixes were already executed
        Specified by:
        hasExecutedNoOfQueryMixes in interface Worker
        Returns: