[ 
https://issues.apache.org/jira/browse/CASSANDRA-19763?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ling Mao updated CASSANDRA-19763:
---------------------------------
    Fix Version/s: 5.x

> Reentrant locks should always be locked outside of a try block
> --------------------------------------------------------------
>
>                 Key: CASSANDRA-19763
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-19763
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Ling Mao
>            Assignee: Ling Mao
>            Priority: Normal
>             Fix For: 5.x
>
>
> {color:#172b4d}Acquiring the lock should always be done before the try block 
> so that the finally clause to unlock will never execute unless the lock is 
> acquired. More info:{color}
>  
> {code:java}
> https://stackoverflow.com/questions/31058681/java-locking-structure-best-pattern
> https://issues.apache.org/jira/browse/AMQ-9202
> {code}
>  
> Unfortunately, there are no ready-made rules in Checkstyle, FindBugs, or 
> SpotBugs for this type of violation checking. I use "IDEA inspection" to 
> identify all such violations.
> {code:java}
> IDEA Code -> Analyze Code -> Run Inspection by Name(Lock acquired but not 
> safely unlocked) ---> Whole project{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to