You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/10/15 12:53:59 UTC

[GitHub] [zookeeper] kamaci commented on a change in pull request #1506: Resources are auto closed within try catch block.

kamaci commented on a change in pull request #1506:
URL: https://github.com/apache/zookeeper/pull/1506#discussion_r505516580



##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnLog.java
##########
@@ -355,8 +355,7 @@ public long getLastLoggedZxid() {
         // the highest zxid
         long zxid = maxLog;
         TxnIterator itr = null;
-        try {
-            FileTxnLog txn = new FileTxnLog(logDir);
+        try (FileTxnLog txn = new FileTxnLog(logDir)) {
             itr = txn.read(maxLog);

Review comment:
       I've updated the PR.




----------------------------------------------------------------
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.

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