HADOOP-12418. TestRPC.testRPCInterruptedSimple fails intermittently. Contributed Kihwal Lee.

This commit is contained in:
Kihwal Lee 2015-10-20 15:08:16 -05:00
parent 6381ddc096
commit 01b103f4ff
2 changed files with 10 additions and 4 deletions

View File

@ -1324,6 +1324,9 @@ Release 2.8.0 - UNRELEASED
HADOOP-12474. MiniKMS should use random ports for Jetty server by default. HADOOP-12474. MiniKMS should use random ports for Jetty server by default.
(Mingliang Liu via wheat9) (Mingliang Liu via wheat9)
HADOOP-12418. TestRPC.testRPCInterruptedSimple fails intermittently.
(kihwal)
Release 2.7.2 - UNRELEASED Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -28,6 +28,7 @@
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.Closeable; import java.io.Closeable;
import java.io.InterruptedIOException;
import java.io.IOException; import java.io.IOException;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo; import java.lang.management.ThreadInfo;
@ -885,11 +886,13 @@ public void testRPCInterruptedSimple() throws IOException {
proxy.ping(); proxy.ping();
fail("Interruption did not cause IPC to fail"); fail("Interruption did not cause IPC to fail");
} catch (IOException ioe) { } catch (IOException ioe) {
if (!ioe.toString().contains("InterruptedException")) { if (ioe.toString().contains("InterruptedException") ||
throw ioe; ioe instanceof InterruptedIOException) {
// clear interrupt status for future tests
Thread.interrupted();
return;
} }
// clear interrupt status for future tests throw ioe;
Thread.interrupted();
} }
} finally { } finally {
server.stop(); server.stop();