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

Xueming Shen xueming.shen at oracle.com
Wed May 8 19:15:14 UTC 2013


On 05/08/2013 11:58 AM, Alan Bateman wrote:
> On 04/05/2013 20:05, Xueming Shen wrote:
>> :
>>
>> Another sync need is for the "init()", in which it may update the aliasMap,
>> classMap and aliasNameMap via charset() and deleteCharset() if those
>> special properties are defined. There are two sources for the charset()/
>> deleteCharset(), one is from the constructor, one is from the init(), given
>> ExtendedCharsets is now singleton and get initialized at class init, these
>> should be no race concern between these two sources, so no need to
>> have any sync block inside charset() and deleteCharset(), the only thing
>> need to defend is inside init(), and all three public methods invoke the
>> init() at the beginning of the method body.
>>
> One question on this. What would be the downside be doing all the initialization in ExtendedCharsets's constructor instead of two phases? Aside from availableCharsets then I would expect that all other usages would require the mappings to be setup.
>
> -Alan.
>

ExtendedCharsets might be loaded/looked up for the default charset during
vm-boot, in which the system properties might not have been initialized yet.
So the "init()" need to be invoked again later, after boot, after we have
those system properties initialized (if specified).

-Sherman



More information about the core-libs-dev mailing list