hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Akash Ashok <thehellma...@gmail.com>
Subject Why doesn't HConnectionManager implement double checked locking ?
Date Tue, 23 Aug 2011 18:45:34 GMT
Hi,
     I have pasted the code below for HConnectionManager.getConnection

  public static HConnection getConnection(Configuration conf)
  throws ZooKeeperConnectionException {
    HConnectionKey connectionKey = new HConnectionKey(conf);
    synchronized (HBASE_INSTANCES) {
      HConnectionImplementation connection =
HBASE_INSTANCES.get(connectionKey);
      if (connection == null) {
        connection = new HConnectionImplementation(conf);
        HBASE_INSTANCES.put(connectionKey, connection);
      }
      connection.incCount();
      return connection;
    }
  }

just curious as to why double checked locking isn't implemented here ? Is it
because there's won't be too many threads calling this method simultaneouly.
?

Cheers,
Akash A

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message