diff --git a/iguana.corecontroller/src/main/java/org/aksw/iguana/cc/tasks/impl/Stresstest.java b/iguana.corecontroller/src/main/java/org/aksw/iguana/cc/tasks/impl/Stresstest.java index c3d39d2a..8be67049 100644 --- a/iguana.corecontroller/src/main/java/org/aksw/iguana/cc/tasks/impl/Stresstest.java +++ b/iguana.corecontroller/src/main/java/org/aksw/iguana/cc/tasks/impl/Stresstest.java @@ -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 @@ -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 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); @@ -330,17 +344,13 @@ private long executeWarmup(List 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 diff --git a/iguana.corecontroller/src/main/java/org/aksw/iguana/cc/worker/AbstractWorker.java b/iguana.corecontroller/src/main/java/org/aksw/iguana/cc/worker/AbstractWorker.java index 6c1d47ae..9e7572a0 100644 --- a/iguana.corecontroller/src/main/java/org/aksw/iguana/cc/worker/AbstractWorker.java +++ b/iguana.corecontroller/src/main/java/org/aksw/iguana/cc/worker/AbstractWorker.java @@ -231,6 +231,9 @@ protected synchronized void setResults(Properties result) { @Override public synchronized Collection popQueryResults() { + if(results.isEmpty()){ + return null; + } Collection ret = this.results; this.results = new LinkedList(); return ret;