hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tsuyoshi Ozawa (JIRA)" <j...@apache.org>
Subject [jira] [Reopened] (HADOOP-11475) Utilize try-with-resource to close StopWatch
Date Thu, 05 Mar 2015 11:32:38 GMT

     [ https://issues.apache.org/jira/browse/HADOOP-11475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Tsuyoshi Ozawa reopened HADOOP-11475:
-------------------------------------

> Utilize try-with-resource to close StopWatch
> --------------------------------------------
>
>                 Key: HADOOP-11475
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11475
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Ted Yu
>            Assignee: Ted Yu
>            Priority: Minor
>         Attachments: hadoop-11475-001.patch
>
>
> Currently the stop() method of StopWatch is called without using finally clause.
> This can result in resource leak if there is IOE thrown.
> Here is one example from Journal#journal():
> {code}
>     StopWatch sw = new StopWatch();
>     sw.start();
>     curSegment.flush(shouldFsync);
>     sw.stop();
> {code}
> If curSegment.flush() throws IOE, sw would be left unclosed.
> Propose using try-with-resource structure to close the StopWatch.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message