Package org.aksw.iguana.cc.worker
Class AbstractWorker
- java.lang.Object
-
- org.aksw.iguana.cc.worker.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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddResults(QueryExecutionStats results)longgetExecutedQueries()This will return the amount of executed queries so farlonggetNoOfQueries()The number of Queries in one mixjava.lang.StringgetQueriesFileName()Returns the name of the queries file name/update pathbooleanhasExecutedNoOfQueryMixes(double noOfQueryMixes)Returns if the no of query mixes were already executedbooleanisTerminated()java.util.Collection<java.util.Properties>popQueryResults()Get and remove all internal stored results of finished queriesvoidrun()voidsetQueriesList(java.io.File[] queries)Sets the Query Instances repr.voidstartWorker()This will start the worker.voidstopSending()This should stop the next sending process.voidwaitTimeMs()This will simulate the Time in ms to wait before testing the next query.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.aksw.iguana.cc.worker.Worker
executeQuery, getNextQuery
-
-
-
-
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:WorkerThis will simulate the Time in ms to wait before testing the next query. It can be used to simulate network delay.- Specified by:
waitTimeMsin interfaceWorker
-
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
-
addResults
public void addResults(QueryExecutionStats results)
-
popQueryResults
public java.util.Collection<java.util.Properties> popQueryResults()
Description copied from interface:WorkerGet and remove all internal stored results of finished queries- Specified by:
popQueryResultsin interfaceWorker- Returns:
- list of Properties to send to RabbitMQ
-
getExecutedQueries
public long getExecutedQueries()
Description copied from interface:WorkerThis will return the amount of executed queries so far- Specified by:
getExecutedQueriesin interfaceWorker- Returns:
- no. of executed queries
-
stopSending
public void stopSending()
Description copied from interface:WorkerThis 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:
stopSendingin interfaceWorker
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminatedin interfaceWorker
-
run
public void run()
- Specified by:
runin interfacejava.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:
getNoOfQueriesin interfaceWorker- Returns:
-
hasExecutedNoOfQueryMixes
public boolean hasExecutedNoOfQueryMixes(double noOfQueryMixes)
Description copied from interface:WorkerReturns if the no of query mixes were already executed- Specified by:
hasExecutedNoOfQueryMixesin interfaceWorker- Returns:
-
-