Re: Why doesn't HConnectionManager implement double checked locking ?

2011-08-25 Thread Akash Ashok
Stack I agree that the connection establishment is indeed expensive but shouldn't that be the reason why we should only have connection establishment in the synchronized block and not the retrieval of the connection object which is already established ? Wat I mean is that, if HBASE_INSTANCES.get(

Re: Why doesn't HConnectionManager implement double checked locking ?

2011-08-24 Thread Stack
I'd imagine the Connection creation expensive, too expensive for the putIfAbsent idiom. What you think Akash? St.Ack On Thu, Aug 25, 2011 at 4:55 AM, Akash Ashok wrote: > I was just curious as to whether this was a hotspot or not. I mean as Ryan > said if its not a part of high perf code path th

Re: Why doesn't HConnectionManager implement double checked locking ?

2011-08-24 Thread Akash Ashok
I was just curious as to whether this was a hotspot or not. I mean as Ryan said if its not a part of high perf code path then its ok. Also now I'm wondering why can't we do a putIfAbsent? More like HConnectionKey connectionKey = new HConnectionKey(conf); HConnectionImplementation connecti

Re: Why doesn't HConnectionManager implement double checked locking ?

2011-08-24 Thread Stack
How would double-checked -- a problematic pattern at the best of times in java (see http://en.wikipedia.org/wiki/Double-checked_locking) -- help here? What you thinking? We can't really do putIfAbsent w/ a connection instance? Good on you Akash, St.Ack On Tue, Aug 23, 2011 at 11:45 AM, Akash As

Re: Why doesn't HConnectionManager implement double checked locking ?

2011-08-23 Thread Ryan Rawson
Not really part of the high perf code path, I'd be interested in seeing profiling that indicates otherwise. On Aug 23, 2011 11:46 AM, "Akash Ashok" wrote: > Hi, > I have pasted the code below for HConnectionManager.getConnection > > public static HConnection getConnection(Configuration conf) > thr

Why doesn't HConnectionManager implement double checked locking ?

2011-08-23 Thread Akash Ashok
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) { HConnectionImplem