[
https://issues.apache.org/jira/browse/YARN-9341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16785162#comment-16785162
]
Wilfred Spiegelenburg commented on YARN-9341:
---------------------------------------------
So we do have one and also one {{lockInterruptibly()}} in another part. The
change as proposed by [~Prabhu Joseph] have left those two unchanged, neither
are covered under the description of the jira either. It just talks about the
{{lock()}} cases.
The only replacements that have been made are the direct calls to {{lock()}} in
the patch neither of the two other ones have been touched. That is where I
based my +1 on
> Reentrant lock() before try
> ---------------------------
>
> Key: YARN-9341
> URL: https://issues.apache.org/jira/browse/YARN-9341
> Project: Hadoop YARN
> Issue Type: Bug
> Components: yarn
> Affects Versions: 3.1.0
> Reporter: Prabhu Joseph
> Assignee: Prabhu Joseph
> Priority: Minor
> Attachments: YARN-9341-001.patch
>
>
> As a best practice - Reentrant lock has to be acquired before try clause.
> https://stackoverflow.com/questions/31058681/java-locking-structure-best-pattern
> There are many places where lock is obtained inside try.
> {code}
> try {
> this.writeLock.lock();
> ....
> } finally {
> this.writeLock.unlock();
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]