[ https://issues.apache.org/jira/browse/YARN-4807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15246217#comment-15246217 ]
Daniel Templeton commented on YARN-4807: ---------------------------------------- Thanks for the update, [~yufeigu]. Back to those loops... I don't think converting the while loops to for loops is the right idea. You end up with ugly for loops. My rule of thumb is that a for loop is for iterating through a sequence with a known number of steps; while loops are for everything else. I think your previous structure: {code} while (timeWaiting < tooLong) { doStuff(); timeWaiting += timeWaited; } {code} was perfectly reasonable. Some of the loops are for-while combinations. I think the best approach in those cases is to split the conditions like: {code} while (conditionsTrue) { if (timeWaiting >= tooLong) { break; } doStuff(); timeWaiting += timeWaited; } {code} It might also be clearer to count the time spent sleeping rather than counting the number of retries, since the latter is just a derivative of the former. In the javadocs, I think you mean "has" everywhere you used "had". Also "if any" is a little too terse for the exception explanation. How about "thrown if an unexpected error occurs"? > MockAM#waitForState sleep duration is too long > ---------------------------------------------- > > Key: YARN-4807 > URL: https://issues.apache.org/jira/browse/YARN-4807 > Project: Hadoop YARN > Issue Type: Sub-task > Affects Versions: 2.8.0 > Reporter: Karthik Kambatla > Assignee: Yufei Gu > Labels: newbie > Attachments: YARN-4807.001.patch, YARN-4807.002.patch, > YARN-4807.003.patch, YARN-4807.004.patch, YARN-4807.005.patch, > YARN-4807.006.patch, YARN-4807.007.patch, YARN-4807.008.patch, > YARN-4807.009.patch > > > MockAM#waitForState sleep duration (500 ms) is too long. Also, there is > significant duplication with MockRM#waitForState. -- This message was sent by Atlassian JIRA (v6.3.4#6332)