RFR 8012326: Deadlock occurs when Charset.availableCharsets() is called by several threads at the same time

Xueming Shen xueming.shen at oracle.com
Fri May 3 15:12:50 UTC 2013


On 5/3/13 7:18 AM, Alan Bateman wrote:
> On 03/05/2013 05:29, Xueming Shen wrote:
>> :
>>
>> An alternative is to really implement the singleton pattern in ECP, 
>> however
>> given the existing mechanism we have in Charset.java and the "hacky" 
>> init()
>> implementation we need in ECP, I go with the current approach.
>>
>> http://cr.openjdk.java.net/~sherman/8012326/webrev
> I'm not sure that I understand your comment, are you saying that the 
> initialize-on-demand holder idiom wouldn't work here? I would think it 
> should make it simpler and easier to understand.

I meant the proposed the change does not change how the 
Charset.forName() works,
which we also had race condition problem in the past. I can go with a 
complete re-work
if you prefer to. I was thinking of re-workng the ECP during the 
investigation, I got couple
other issues with it as well. But decided to go the easy way given I 
still have bunch other
bugs to go after for jdk8.

-Sherman

>
> For the ISO2022_JP_2 and MSISO2022JP then they probably don't need to 
> be volatile. As it stands then the fields may get written more than 
> once (which is harmless).
>
> -Alan.




More information about the core-libs-dev mailing list