hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tsz Wo Nicholas Sze (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-8546) Use try with resources in DataStorage and Storage
Date Fri, 12 Jun 2015 22:25:00 GMT

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

Tsz Wo Nicholas Sze commented on HDFS-8546:
-------------------------------------------

{code}
+    try (RandomAccessFile oldFile = new RandomAccessFile(oldF, "rws")) {
+      FileLock oldLock = oldFile.getChannel().tryLock();
{code}
The oldLock above should be inside try(..).

> Use try with resources in DataStorage and Storage
> -------------------------------------------------
>
>                 Key: HDFS-8546
>                 URL: https://issues.apache.org/jira/browse/HDFS-8546
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: datanode
>    Affects Versions: 2.7.0
>            Reporter: Andrew Wang
>            Assignee: Andrew Wang
>            Priority: Minor
>         Attachments: HDFS-8546.001.patch, HDFS-8546.002.patch, HDFS-8546.003.patch, HDFS-8546.004.patch
>
>
> We have some old-style try/finally to close files in DataStorage and Storage, let's update
them.
> Also a few small cleanups:
> * Actually check that tryLock returns a FileLock in isPreUpgradableLayout
> * Remove unused parameter from writeProperties
> * Add braces for one-line if statements per coding style



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

Mime
View raw message