[
https://issues.apache.org/jira/browse/YARN-6236?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tao Jie updated YARN-6236:
--------------------------
Attachment: YARN-6236.001.patch
> Move lock() out of try-block in FairScheduler
> ---------------------------------------------
>
> Key: YARN-6236
> URL: https://issues.apache.org/jira/browse/YARN-6236
> Project: Hadoop YARN
> Issue Type: Bug
> Reporter: Tao Jie
> Assignee: Tao Jie
> Attachments: YARN-6236.001.patch
>
>
> As discussed in YARN-6215, {{read/writeLock.lock()}} inside the try-block is
> widely used in existing code, especially in FairScheduler.java, eg:
> {code}
> public ResourceWeights getAppWeight(FSAppAttempt app) {
> try {
> readLock.lock();
> ...
> ...
> return resourceWeights;
> } finally {
> readLock.unlock();
> }
> }
> {code}
> However in the best practice, {{lock()}} should be called outside of the
> try-block. In case of exception happens on {{lock()}} itself, {{unlock()}} in
> finally should not be invoked.
> We'd better to move {{lock()}} out of try-block.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]