[
https://issues.apache.org/jira/browse/YARN-7133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16553934#comment-16553934
]
Szilard Nemeth commented on YARN-7133:
--------------------------------------
One more reason here: https://stackoverflow.com/a/10868476/1106893
Quote: "The Java documentation, however, leaves lock() outside the try block in
the ReentrantLock example. The reason for this is that an unchecked exception
in lock() should not lead to unlock() incorrectly being called. "
> Clean up lock-try order in fair scheduler
> -----------------------------------------
>
> Key: YARN-7133
> URL: https://issues.apache.org/jira/browse/YARN-7133
> Project: Hadoop YARN
> Issue Type: Improvement
> Components: fairscheduler
> Affects Versions: 3.0.0-alpha4
> Reporter: Daniel Templeton
> Assignee: Szilard Nemeth
> Priority: Major
> Labels: newbie
> Attachments: YARN-7133.001.patch
>
>
> There are many places that follow the pattern:{code}try {
> lock.lock();
> ...
> } finally {
> lock.unlock();
> }{code}
> There are a couple of reasons that's a bad idea. The correct pattern
> is:{code}lock.lock();
> try {
> ...
> } finally {
> lock.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]