cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Greene (JIRA)" <j...@apache.org>
Subject [jira] Updated: (CASSANDRA-228) Improve the readability of the DBManager.instance() method
Date Wed, 12 Aug 2009 01:12:16 GMT

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

Michael Greene updated CASSANDRA-228:
-------------------------------------

    Component/s: Core

> Improve the readability of the DBManager.instance() method
> ----------------------------------------------------------
>
>                 Key: CASSANDRA-228
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-228
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Edward Ribeiro
>            Assignee: Edward Ribeiro
>             Fix For: 0.4
>
>         Attachments: CASSANDRA-228.patch
>
>
> The DBManager class implements the singleton pattern using a Lock object, but it could
replace the Lock object by declaring the instance() method as synchronized. Therefore, it
avoids the race condition (as with Lock), but improves the readability and reduces the size
of the method. Below is the new version of the method:
> 	public static synchronized DBManager instance() throws IOException
> 	{
> 		if (dbMgr_ == null)
> 			dbMgr_ = new DBManager();
> 		return dbMgr_;
> 	}

-- 
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