On Mon, Oct 13, 2008 at 12:43 AM, Jim Kellerman (POWERSET)
<[EMAIL PROTECTED]> wrote:
> No, the change to RegionHistorian was only to make the instantiation
> of the singleton thread safe, which it was not before.
>

IIRC what I read about java memory model, you do not need synchronized
there if you make a few changes:

  /** Singleton reference */
  private static RegionHistorian historian = new RegionHistorian();

I think if you do this, Java guarantees that historian won't be
initialized until it is accessed
(because static members are only initialized when a class is loaded)
and it will be thread-safe.
So you can get rid of "synchronized" in getInstance.


> ---
> Jim Kellerman, Powerset (Live Search, Microsoft Corporation)
>
>
>> -----Original Message-----
>> From: stack [mailto:[EMAIL PROTECTED]
>> Sent: Saturday, October 11, 2008 4:02 PM
>> To: [email protected]
>> Subject: Re: svn commit: r703711 - in /hadoop/hbase/trunk: CHANGES.txt
>> src/java/org/apache/hadoop/hbase/RegionHistorian.java
>> src/java/org/apache/hadoop/hbase/master/RegionManager.java
>>
>> [EMAIL PROTECTED] wrote:
>> > +   HBASE-918   Region balancing during startup makes cluster unstable
>> >  ...
>> > URL:
>> http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop
>> /hbase/RegionHistorian.java?rev=703711&r1=703710&r2=703711&view=diff
>> >
>> ==========================================================================
>> ====
>> > ---
>> hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/RegionHistorian.java
>> (original)
>> > +++
>> hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/RegionHistorian.java
>> Sat Oct 11 12:04:09 2008
>> > @@ -86,7 +86,7 @@
>> >     * Get the RegionHistorian Singleton instance.
>> >     * @return The region historian
>> >     */
>> > -  public static RegionHistorian getInstance() {
>> > +  public synchronized static RegionHistorian getInstance() {
>> >
>>
>> Was it adding the synchronized here that made it so regionhistorian
>> could continue to use HTable?  i.e. fixes HBASE-919?
>> St.Ack
>>
>
>



-- 
Doğacan Güney

Reply via email to