From 4ecbe2e9bf121bc58a6c868293af91ce4a749a8d Mon Sep 17 00:00:00 2001 From: Masatake Iwasaki Date: Fri, 6 May 2016 15:36:47 +0900 Subject: [PATCH] HDFS-2043. TestHFlush failing intermittently. Contributed by Lin Yiqun. (cherry picked from commit 2835f146b551f911ea13307e7762759813898757) --- .../test/java/org/apache/hadoop/hdfs/TestHFlush.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHFlush.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHFlush.java index 1846cc9113f..ce49f698210 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHFlush.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHFlush.java @@ -485,8 +485,14 @@ public class TestHFlush { // If we got the exception, we shouldn't have interrupted status anymore. assertFalse(Thread.interrupted()); - // Now do a successful close. - stm.close(); + // Do the try-catch in the second stm.close() avoid that streamer was already + // closed in other places. + try { + // Now do a successful close. + stm.close(); + } catch (IOException e) { + System.out.println("Got expected exception during second close"); + } }