Permalink
Browse files

Fix concurrent computation test

It was false to assume that when each worker finishes the shared job
queue is empty. It may be that the last job is taken by one worker, the
other worker has nothing to process so it runs finish(), but the first
worker  puts the job to the shared queue, so it is not empty.
  • Loading branch information...
ykazakov committed Sep 22, 2017
1 parent b1745c7 commit 9fe0f8f6a0eb90300437a5a7eca8e065c99d8562
@@ -21,8 +21,6 @@
*/
package org.semanticweb.elk.util.concurrent.computation;
import static org.junit.Assert.fail;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;
@@ -77,8 +75,6 @@ public void process() throws InterruptedException {
@Override
public void finish() {
aggregatedSum_.addAndGet(sum_);
if (!isInterrupted() && !todo_.isEmpty())
fail();
}
}

0 comments on commit 9fe0f8f

Please sign in to comment.