This is an automated email from the ASF dual-hosted git repository.

weichiu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 2a4fcde  HDDS-5888. Handle InterruptedException in OzoneClientProducer 
and ContainerBalancer (#2761)
2a4fcde is described below

commit 2a4fcdee692e64434d03e5de22e88f98ebbdc33d
Author: Ke-Yi Sung <[email protected]>
AuthorDate: Fri Oct 22 20:29:11 2021 +0800

    HDDS-5888. Handle InterruptedException in OzoneClientProducer and 
ContainerBalancer (#2761)
---
 .../hdds/scm/container/balancer/ContainerBalancer.java   |  4 +++-
 .../org/apache/hadoop/ozone/s3/OzoneClientProducer.java  | 16 +++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
index 3afcd5f..646ff8a 100644
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
+++ 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
@@ -208,6 +208,7 @@ public class ContainerBalancer {
           } catch (InterruptedException e) {
             LOG.info("Container Balancer was interrupted while waiting for" +
                 " next iteration.");
+            Thread.currentThread().interrupt();
             return;
           }
         }
@@ -782,7 +783,8 @@ public class ContainerBalancer {
       currentBalancingThread.interrupt();
       try {
         currentBalancingThread.join();
-      } catch (InterruptedException ignored) {
+      } catch (InterruptedException exception) {
+        Thread.currentThread().interrupt();
       }
     }
     currentBalancingThread = null;
diff --git 
a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/OzoneClientProducer.java
 
b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/OzoneClientProducer.java
index 83809c3..e7d3ed0 100644
--- 
a/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/OzoneClientProducer.java
+++ 
b/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/OzoneClientProducer.java
@@ -118,9 +118,8 @@ public class OzoneClientProducer {
         identifier.setSignature(signatureInfo.getSignature());
         identifier.setAwsAccessId(awsAccessId);
         identifier.setOwner(new Text(awsAccessId));
-        if (LOG.isTraceEnabled()) {
-          LOG.trace("Adding token for service:{}", omService);
-        }
+        LOG.trace("Adding token for service:{}", omService);
+
         Token<OzoneTokenIdentifier> token = new Token(identifier.getBytes(),
             identifier.getSignature().getBytes(StandardCharsets.UTF_8),
             identifier.getKind(),
@@ -133,16 +132,15 @@ public class OzoneClientProducer {
             return createOzoneClient();
           });
     } catch (OS3Exception ex) {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Error during Client Creation: ", ex);
-      }
+      LOG.debug("Error during Client Creation: ", ex);
       throw wrapOS3Exception(ex);
+    } catch(InterruptedException ex){
+      LOG.debug("Error during Client Creation: ", ex);
+      Thread.currentThread().interrupt();
     } catch (Exception e) {
       // For any other critical errors during object creation throw Internal
       // error.
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Error during Client Creation: ", e);
-      }
+      LOG.debug("Error during Client Creation: ", e);
       throw wrapOS3Exception(INTERNAL_ERROR);
     }
     return ozoneClient;

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to