Fixes test cases for master-worker-pattern

上级 054b1eaa
......@@ -75,7 +75,7 @@ public abstract class Master {
}
private void divideWork(Input<?> input) {
List<? extends Input<?>> dividedInput = input.divideData(numOfWorkers);
var dividedInput = input.divideData(numOfWorkers);
if (dividedInput != null) {
this.expectedNumResults = dividedInput.size();
for (var i = 0; i < this.expectedNumResults; i++) {
......@@ -83,6 +83,13 @@ public abstract class Master {
this.workers.get(i).setReceivedData(this, dividedInput.get(i));
this.workers.get(i).start();
}
for (var i = 0; i < this.expectedNumResults; i++) {
try {
this.workers.get(i).join();
} catch (InterruptedException e) {
System.err.println("Error while executing thread");
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册