diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index d9c796322a..820607f834 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -378,6 +378,9 @@ Release 2.4.1 - UNRELEASED HADOOP-10456. Bug in Configuration.java exposed by Spark (ConcurrentModificationException). (Nishkam Ravi via cnauroth) + HADOOP-10473. TestCallQueueManager should interrupt before counting calls. + (szetszwo) + Release 2.4.0 - 2014-04-07 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestCallQueueManager.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestCallQueueManager.java index 446edfb2f8..1b618b1ce8 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestCallQueueManager.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestCallQueueManager.java @@ -19,7 +19,6 @@ package org.apache.hadoop.ipc; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.HashMap; @@ -49,7 +48,7 @@ public class Putter implements Runnable { public volatile int callsAdded = 0; // How many calls we added, accurate unless interrupted private final int maxCalls; - private boolean isRunning = true; + private volatile boolean isRunning = true; public Putter(CallQueueManager aCq, int maxCalls, int tag) { this.maxCalls = maxCalls; @@ -201,16 +200,22 @@ public void testSwapUnderContention() throws InterruptedException { // Ensure no calls were dropped long totalCallsCreated = 0; - long totalCallsConsumed = 0; - for (Putter p : producers) { - totalCallsCreated += p.callsAdded; threads.get(p).interrupt(); } + for (Putter p : producers) { + threads.get(p).join(); + totalCallsCreated += p.callsAdded; + } + + long totalCallsConsumed = 0; for (Taker t : consumers) { - totalCallsConsumed += t.callsTaken; threads.get(t).interrupt(); } + for (Taker t : consumers) { + threads.get(t).join(); + totalCallsConsumed += t.callsTaken; + } assertEquals(totalCallsConsumed, totalCallsCreated); }