You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Ling Mao (Jira)" <ji...@apache.org> on 2024/07/11 14:09:00 UTC
[jira] [Created] (CASSANDRA-19763) Reentrant locks should always be locked outside of a try block
Ling Mao created CASSANDRA-19763:
------------------------------------
Summary: 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
{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: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org