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 void
addResults(QueryExecutionStats results)
long
getExecutedQueries()
This will return the amount of executed queries so farlong
getNoOfQueries()
The number of Queries in one mixjava.lang.String
getQueriesFileName()
Returns the name of the queries file name/update pathboolean
hasExecutedNoOfQueryMixes(double noOfQueryMixes)
Returns if the no of query mixes were already executedboolean
isTerminated()
java.util.Collection<java.util.Properties>
popQueryResults()
Get and remove all internal stored results of finished queriesvoid
run()
void
setQueriesList(java.io.File[] queries)
Sets the Query Instances repr.void
startWorker()
This will start the worker.void
stopSending()
This should stop the next sending process.void
waitTimeMs()
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: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 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:Worker
Get and remove all internal stored results of finished queries- Specified by:
popQueryResults
in interfaceWorker
- 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 interfaceWorker
- 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 interfaceWorker
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfaceWorker
-
run
public void run()
- Specified by:
run
in 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:
getNoOfQueries
in interfaceWorker
- 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 interfaceWorker
- Returns:
-
-