zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andor Molnar (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ZOOKEEPER-2218) Close IO Streams in finally block
Date Fri, 26 Oct 2018 09:51:00 GMT

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-2218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16664954#comment-16664954
] 

Andor Molnar commented on ZOOKEEPER-2218:
-----------------------------------------

I think this is a nice improvement, but given that we already support Java 7/8, I think we
should use try-with-resources instead:
http://tutorials.jenkov.com/java-exception-handling/try-with-resources.html

> Close IO Streams in finally block
> ---------------------------------
>
>                 Key: ZOOKEEPER-2218
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2218
>             Project: ZooKeeper
>          Issue Type: Bug
>            Reporter: Tang Xinye
>            Assignee: Tang Xinye
>            Priority: Critical
>             Fix For: 3.6.0
>
>         Attachments: ZOOKEEPER-2218.patch, ZOOKEEPER-2218.patch
>
>
> The problem here is that if an exception is thrown during the read process the method
will exit without closing the stream and hence without releasing the file system resources,
it may run out of resources before it does run.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message