hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ayush Saxena (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-16282) Avoid FileStream to improve performance
Date Wed, 01 May 2019 19:56:00 GMT

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

Ayush Saxena commented on HADOOP-16282:
---------------------------------------

Thanx [~giovanni.fumarola]

{code:java}
//Old Code
new FileInputStream(procfsMemFile)
{code}
This part throws FNF and no other block throws any Exception.


{code:java}
// New Code
Files.newInputStream(Paths.get(procfsMemFile))
{code}
This part throws IOE and no other block throws any Exception.

This is the only changed part, so we won't hide away any other exception coming from the part
not being handled before.

A simple verification can done to proof the fact, just temporarily remove the {{Files.newInputStream(Paths.get(procfsMemFile))}}
and the IOE catch gives {{Unreachable catch block for IOException. This exception is never
thrown from the try statement body}}




> Avoid FileStream to improve performance
> ---------------------------------------
>
>                 Key: HADOOP-16282
>                 URL: https://issues.apache.org/jira/browse/HADOOP-16282
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Ayush Saxena
>            Assignee: Ayush Saxena
>            Priority: Major
>         Attachments: HADOOP-16282-01.patch, HADOOP-16282-02.patch
>
>
> The FileInputStream and FileOutputStream classes contains a finalizer method which will
cause garbage collection pauses. See [JDK-8080225|https://bugs.openjdk.java.net/browse/JDK-8080225]
for details.
> The FileReader and FileWriter constructors instantiate FileInputStream and FileOutputStream,
again causing garbage collection issues while finalizer methods are called.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message