Re: Request for review: Race conditions in java.nio.charset.Charset

2009-10-14 Thread Ulf Zibis
Am 07.10.2009 23:01, Xueming Shen schrieb: Ulf Zibis wrote: Sherman, thanks for your review ... Am 07.10.2009 19:56, Xueming Shen schrieb: Though I did not write the cache code my reading suggests the existing cache impl tries to avoid the relatively expensive synchronization for most use

Re: Request for review: Race conditions in java.nio.charset.Charset

2009-10-08 Thread David Holmes - Sun Microsystems
Hi Ulf, Ulf Zibis said the following on 10/08/09 20:07: Am 08.10.2009 06:35, David Holmes - Sun Microsystems schrieb: Ulf Zibis said the following on 10/08/09 08:58: For my better understanding: Can you explain me the real bug in http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6881442. In

Re: Request for review: Race conditions in java.nio.charset.Charset

2009-10-08 Thread Ulf Zibis
Am 08.10.2009 06:35, David Holmes - Sun Microsystems schrieb: Ulf, Ulf Zibis said the following on 10/08/09 08:58: For my better understanding: Can you explain me the real bug in http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6881442. In my understanding, loading the name field twice is

Re: Request for review: Race conditions in java.nio.charset.Charset

2009-10-08 Thread David Holmes - Sun Microsystems
Ulf Zibis said the following on 10/08/09 21:58: Am 08.10.2009 12:59, David Holmes - Sun Microsystems schrieb: It's a memory model issue. The code is like this: public String getName() { if (name == null) name = getName0(); return name; } but in theory,

Re: Request for review: Race conditions in java.nio.charset.Charset

2009-10-07 Thread Xueming Shen
Ulf, Though I did not write the cache code my reading suggests the existing cache impl tries to avoid the relatively expensive synchronization for most use scenarios, your approach however hits the synchronization for each/every lookup invocation. So you should at least consider to put the

Re: Request for review: Race conditions in java.nio.charset.Charset

2009-10-07 Thread Martin Buchholz
On Wed, Oct 7, 2009 at 15:58, Ulf Zibis ulf.zi...@gmx.de wrote: For my better understanding: Can you explain me the real bug in http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6881442. In my understanding, loading the name field twice is too only a performance bug. Please correct me!

Re: Request for review: Race conditions in java.nio.charset.Charset

2009-10-07 Thread David Holmes - Sun Microsystems
Ulf, Ulf Zibis said the following on 10/08/09 08:58: For my better understanding: Can you explain me the real bug in http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6881442. In my understanding, loading the name field twice is too only a performance bug. Please correct me!

Request for review: Race conditions in java.nio.charset.Charset

2009-10-06 Thread Ulf Zibis
I.) Internal charset cache will be corrupted in theoretical race conditions: Startpoint: cache1 -- Charset1 cache2 -- Charset2 Scenario 1: - Thread1 asks for Charset2 via Charset.forName(Charset2). - If Thread1 is interrupted after code line: cache2 = cache1 in method lookup2(String