Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
TortugaAttack committed Feb 1, 2021
1 parent f01d5e3 commit 1d7c3d4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public void execute() {
// if so send all results buffered
sendWorkerResult(worker);
}

loopSleep(100);
}
LOGGER.debug("Sending stop signal to workers");
// tell all workers to stop sending properties, thus the await termination will
Expand Down Expand Up @@ -246,9 +246,23 @@ public void execute() {

}

private void loopSleep(int timeout) {
try {
TimeUnit.MILLISECONDS.sleep(timeout);

}catch(Exception e) {
LOGGER.error("Could not warmup ");
}
}

private void sendWorkerResult(Worker worker){
for (Properties results : worker.popQueryResults()) {
Collection<Properties> props = worker.popQueryResults();
if(props == null){
return;
}
for (Properties results : props) {
try {

// send results via RabbitMQ
LOGGER.debug("[TaskID: {{}}] Send results", taskID);
this.sendResults(results);
Expand Down Expand Up @@ -330,17 +344,13 @@ private long executeWarmup(List<Worker> warmupWorkers) {
*/
protected boolean isFinished() {
if (timeLimit !=null) {
try {
TimeUnit.MILLISECONDS.sleep(10);

}catch(Exception e) {
LOGGER.error("Could not warmup ");
}

Instant current = Instant.now();
double passed_time = timeLimit - durationInMilliseconds(this.startTime, current);
return passed_time <= 0D;
}
else if (noOfQueryMixes != null) {

// use noOfQueries of SPARQLWorkers (as soon as a worker hit the noOfQueries, it
// will stop sending results
// UpdateWorker are allowed to execute all their updates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ protected synchronized void setResults(Properties result) {

@Override
public synchronized Collection<Properties> popQueryResults() {
if(results.isEmpty()){
return null;
}
Collection<Properties> ret = this.results;
this.results = new LinkedList<Properties>();
return ret;
Expand Down

0 comments on commit 1d7c3d4

Please sign in to comment.