Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-228

Improve the readability of the DBManager.instance() method

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 0.4
    • None
    • None

    Description

      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_; }

      Attachments

        1. CASSANDRA-228.patch
          1 kB
          Edward Ribeiro

        Activity

          People

            eribeiro Edward Ribeiro
            eribeiro Edward Ribeiro
            Edward Ribeiro
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: