zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddiede...@apache.org
Subject [zookeeper] branch master updated: ZOOKEEPER-4033: Remove unnecessary judgment of null
Date Thu, 24 Dec 2020 17:13:52 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new a67272a  ZOOKEEPER-4033: Remove unnecessary judgment of null
a67272a is described below

commit a67272a0ad8b1138c61306a02563fc39a0c79101
Author: lan <1728209643@qq.com>
AuthorDate: Thu Dec 24 17:12:37 2020 +0000

    ZOOKEEPER-4033: Remove unnecessary judgment of null
    
    Author: lan <1728209643@qq.com>
    
    Reviewers: Enrico Olivelli <eolivelli@apache.org>, Damien Diederen <ddiederen@apache.org>
    
    Closes #1562 from lanicc/ZOOKEEPER-4033
---
 .../org/apache/zookeeper/server/quorum/QuorumPeerMain.java   | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeerMain.java
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeerMain.java
index 6e8f7b9..5ed2d42 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeerMain.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumPeerMain.java
@@ -150,7 +150,7 @@ public class QuorumPeerMain {
         }
 
         LOG.info("Starting quorum peer, myid=" + config.getServerId());
-        MetricsProvider metricsProvider;
+        final MetricsProvider metricsProvider;
         try {
             metricsProvider = MetricsProviderBootstrap.startMetricsProvider(
                 config.getMetricsProviderClassName(),
@@ -233,12 +233,10 @@ public class QuorumPeerMain {
             // warn, but generally this is ok
             LOG.warn("Quorum Peer interrupted", e);
         } finally {
-            if (metricsProvider != null) {
-                try {
-                    metricsProvider.stop();
-                } catch (Throwable error) {
-                    LOG.warn("Error while stopping metrics", error);
-                }
+            try {
+                metricsProvider.stop();
+            } catch (Throwable error) {
+                LOG.warn("Error while stopping metrics", error);
             }
         }
     }


Mime
View raw message