This is an automated email from the ASF dual-hosted git repository.
dineshc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git
The following commit(s) were added to refs/heads/master by this push:
new e4964d9 Handle InterruptedException sonar issues in
ContainerMetadataScanner (#908)
e4964d9 is described below
commit e4964d93dacf3f909440d23821abb6058759d6da
Author: danidelvalle <[email protected]>
AuthorDate: Thu May 14 04:00:47 2020 +0200
Handle InterruptedException sonar issues in ContainerMetadataScanner (#908)
---
.../ozone/container/ozoneimpl/ContainerMetadataScanner.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerMetadataScanner.java
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerMetadataScanner.java
index 50ea576..96efcf4 100644
---
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerMetadataScanner.java
+++
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/ozoneimpl/ContainerMetadataScanner.java
@@ -110,6 +110,10 @@ public class ContainerMetadataScanner extends Thread {
} catch (InterruptedException e) {
LOG.info("Background ContainerMetadataScanner interrupted." +
" Going to exit");
+ // Restore the interruption flag and the internal `stopping`
+ // variable to prevent the next iteration thus stopping the thread
+ interrupt();
+ this.stopping = true;
}
}
}
@@ -129,13 +133,19 @@ public class ContainerMetadataScanner extends Thread {
return metrics;
}
+ /**
+ * Shutdown the ContainerMetadataScanner thread.
+ */
+ // Ignore the sonar false positive on the InterruptedException issue
+ // as this a normal flow of a shutdown.
+ @SuppressWarnings("squid:S2142")
public synchronized void shutdown() {
this.stopping = true;
this.interrupt();
try {
this.join();
} catch (InterruptedException ex) {
- LOG.warn("Unexpected exception while stopping metadata scanner.", ex);
+ LOG.debug("Interrupted exception while stopping metadata scanner.", ex);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]