You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2021/09/02 13:17:03 UTC

[GitHub] [bookkeeper] ruanwenjun opened a new pull request #2783: Use try with resource to optimize code

ruanwenjun opened a new pull request #2783:
URL: https://github.com/apache/bookkeeper/pull/2783


   Descriptions of the changes in this PR:
   
   ### Motivation
   
   Optimize code
   
   ### Changes
   
   1. Use try with resource to optimize close
   2. remove isDebugEnabled
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] dlg99 commented on a change in pull request #2783: Use try with resource to optimize code

Posted by GitBox <gi...@apache.org>.
dlg99 commented on a change in pull request #2783:
URL: https://github.com/apache/bookkeeper/pull/2783#discussion_r715163134



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
##########
@@ -123,9 +123,7 @@ public static ZooKeeperServerShim runZookeeper(int maxCC, int zookeeperPort, Fil
 
         boolean b = waitForServerUp(InetAddress.getLoopbackAddress().getHostAddress() + ":" + zookeeperPort,
           CONNECTION_TIMEOUT);
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("ZooKeeper server up: {}", b);
-        }
+        LOG.debug("ZooKeeper server up: {}", b);

Review comment:
       please keep `if (LOG.isDebugEnabled())`
   `b` is boolean, log.debug takes Object as parameter sfo check for isDebugEnabled helps to avoid boxing.
   It is not critical for the boolean per se (only two values/preallocated) but i'd keep it for the consistency with other places. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] dlg99 merged pull request #2783: Use try with resource to optimize code

Posted by GitBox <gi...@apache.org>.
dlg99 merged pull request #2783:
URL: https://github.com/apache/bookkeeper/pull/2783


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] dlg99 commented on pull request #2783: Use try with resource to optimize code

Posted by GitBox <gi...@apache.org>.
dlg99 commented on pull request #2783:
URL: https://github.com/apache/bookkeeper/pull/2783#issuecomment-926731747


   @eolivelli did you mean to approve the change? :)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] eolivelli commented on pull request #2783: Use try with resource to optimize code

Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #2783:
URL: https://github.com/apache/bookkeeper/pull/2783#issuecomment-927980239


   > @eolivelli did you mean to approve the change? :)
   
   yes, sorry
   
   please go ahead and merge @dlg99 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] dlg99 merged pull request #2783: Use try with resource to optimize code

Posted by GitBox <gi...@apache.org>.
dlg99 merged pull request #2783:
URL: https://github.com/apache/bookkeeper/pull/2783


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] ruanwenjun commented on a change in pull request #2783: Use try with resource to optimize code

Posted by GitBox <gi...@apache.org>.
ruanwenjun commented on a change in pull request #2783:
URL: https://github.com/apache/bookkeeper/pull/2783#discussion_r715261168



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
##########
@@ -123,9 +123,7 @@ public static ZooKeeperServerShim runZookeeper(int maxCC, int zookeeperPort, Fil
 
         boolean b = waitForServerUp(InetAddress.getLoopbackAddress().getHostAddress() + ":" + zookeeperPort,
           CONNECTION_TIMEOUT);
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("ZooKeeper server up: {}", b);
-        }
+        LOG.debug("ZooKeeper server up: {}", b);

Review comment:
       OK




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org