[ https://issues.apache.org/jira/browse/HDFS-7829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14358582#comment-14358582 ]
Takanobu Asanuma commented on HDFS-7829: ---------------------------------------- I would like to report my thoughts. 1. {{LocatedBlock(ExtendedBlock, DatanodeInfo[], long, boolean)}} I found other places with pass is not -1 and false for the last two arguments. {{TestDFSClientRetries.FailNTimesAnswer.makeBadBlockList}}, {{TestDFSUtil.testLocatedBlocks2Locations}}, {{TestPBHelper.createLocatedBlockNoStorageMedia}} So it is difficult to remove this constructor. 2. {{LocatedBlock(ExtendedBlock, DatanodeStorageInfo[])}} This can be replaced by other constructor. 3. {{LocatedBlock(ExtendedBlock b, DatanodeInfo[], String[], StorageType[])}} This is difficult to replaced by {{LocatedBlock(ExtendedBlock, DatanodeStorageInfo[], long, boolean)}}. Because it is need more information to create instances of {{DatanodeStorageInfo}}. Conversely, {{LocatedBlock(ExtendedBlock, DatanodeStorageInfo[], long, boolean)}} can be replaced by {{LocatedBlock(ExtendedBlock b, DatanodeInfo[], String[], StorageType[])}}. So I think we can remove {{LocatedBlock(ExtendedBlock, DatanodeStorageInfo[])}} and {{LocatedBlock(ExtendedBlock, DatanodeStorageInfo[], long, boolean)}}. Please would you check it? > Code clean up for LocatedBlock > ------------------------------ > > Key: HDFS-7829 > URL: https://issues.apache.org/jira/browse/HDFS-7829 > Project: Hadoop HDFS > Issue Type: Improvement > Reporter: Jing Zhao > Assignee: Takanobu Asanuma > Priority: Minor > Attachments: HDFS-7829.1.patch, HDFS-7829.2.patch, HDFS-7829.3.patch > > > We can do some code cleanup for {{LocatedBlock}}, including: > # Using a simple Builder pattern to avoid multiple constructors > # Setting data fields like {{corrupt}} and {{offset}} to final -- This message was sent by Atlassian JIRA (v6.3.4#6332)