From d0c0b8212fd905f91bc7fbec3aa233e6f7a21ae8 Mon Sep 17 00:00:00 2001 From: cxorm Date: Mon, 25 Nov 2019 17:55:23 +0800 Subject: [PATCH 1/3] Re-Interrupt when catching the InterruptedException --- .../apache/hadoop/ozone/container/common/volume/VolumeSet.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeSet.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeSet.java index 875e96a0a96e..275f043f5fb2 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeSet.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeSet.java @@ -211,6 +211,7 @@ private void checkAllVolumes() throws IOException { try { failedVolumes = volumeChecker.checkAllVolumes(allVolumes); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new IOException("Interrupted while running disk check", e); } From 7e664ee69e0cfce81a4822c78fe173186d70d4c9 Mon Sep 17 00:00:00 2001 From: cxorm Date: Mon, 25 Nov 2019 17:55:55 +0800 Subject: [PATCH 2/3] Update UT to test interrupt --- .../common/volume/TestVolumeSet.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestVolumeSet.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestVolumeSet.java index fa280ddb7308..e3571e52e763 100644 --- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestVolumeSet.java +++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestVolumeSet.java @@ -44,6 +44,7 @@ import org.junit.rules.Timeout; import java.io.File; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -243,4 +244,27 @@ public void testFailVolumes() throws Exception{ } } + + @Test + public void testInterrupt() throws Exception { + Method method = this.volumeSet.getClass() + .getDeclaredMethod("checkAllVolumes"); + method.setAccessible(true); + String exceptionMessage = ""; + + try { + Thread.currentThread().interrupt(); + method.invoke(this.volumeSet); + if (Thread.currentThread().isInterrupted()) { + throw new InterruptedException("Interruption Occur"); + } + } catch (InterruptedException interruptedException) { + exceptionMessage = "InterruptedException Occur."; + } + + assertEquals( + "InterruptedException Occur.", + exceptionMessage); + } + } From 7473d135aabd550f2160fca698f15ea8446699b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Elek?= Date: Tue, 3 Dec 2019 16:26:47 +0100 Subject: [PATCH 3/3] retrigger build with empty commit