cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Ellis (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CASSANDRA-248) Replace factory method based on explicit locks for a more succint syntax
Date Sun, 21 Jun 2009 02:06:07 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12722289#action_12722289
] 

Jonathan Ellis commented on CASSANDRA-248:
------------------------------------------

This is double-checked locking.  It's faster than doing a straightforward "synchronized" since
you only have to lock if the variable is not yet initialized.

Some of the DCL instance() methods in the code are unnecessary (because the code is not on
a critical path) but this is probably not one of those.

However, the ones that we should keep are mostly broken -- you need the cached instance to
be marked `volatile` for it to be correct.

If you want to audit all the instance() implementations for that, that would be great.  I'd
like to do it all as one patch.

> Replace factory method based on explicit locks for a more succint syntax
> ------------------------------------------------------------------------
>
>                 Key: CASSANDRA-248
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-248
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Edward Ribeiro
>         Attachments: CASSANDRA-248.patch
>
>
> Replace factory method based on explicit locks for a more succint syntax. The code becomes
simpler and more readable.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message