RFR 8060068 : Remove the static initializer block from DriverManager

Lance Andersen lance.andersen at oracle.com
Tue Dec 2 18:46:23 UTC 2014


Hi Stuart,
On Dec 2, 2014, at 1:35 PM, Stuart Marks <stuart.marks at oracle.com> wrote:

> Hi Lance,
> 
> Overall, looks fine.

Thank you for the review
> 
> Typo "earleir" at line 569.

fixed
> 
> I agree with having two separate init methods, since initDriversIfNeeded() conveniently separates the (safe) double-checked locking idiom from the actual initialization legwork in loadInitialDrivers().
> 
> I'm not entirely convinced, however :-), that DCL is necessary, but I could see that it might be helpful if some of these operations are called frequently. Sorry if this had been discussed previously.

getConnection in particular can get called often in some environments so I thought using DCL would be the safe way to go.

Best,
Lance

> 
> s'marks
> 
> 
> 
> On 12/1/14 12:39 PM, Lance Andersen wrote:
>> Hi Ulf,
>> 
>> thank you for the input and  suggestion
>> 
>> 
>> On Dec 1, 2014, at 3:27 PM, Ulf Zibis <Ulf.Zibis at CoSoCo.de> wrote:
>> 
>>> Hi Lance,
>>> 
>>> to me it's irritating, why there are 2 methods:
>>> - initDriversIfNeeded()
>>> - loadInitialDrivers()
>>> I would combine both to one method.
>> 
>> Mandy had asked me previously about this and here was my reply
>> 
>> -----------------
>> The reason I had the two methods was to further reduce contention checking to see if the drivers need to be loaded.  getConnection  gets called frequently so I thought that not having the initial check synchronized would be more efficient
>> -----------------
>> 
>> 
>> I think the code gets harder to read if I have one large synchronized block  assuming I move everything from loadInitialDrivers into the  existing synchronized block in initDriversIfNeeded.
>> 
>>> In lines 90 + 92 there are double spaces.
>> 
>> Thank you.
>>> 
>>> -Ulf
>>> 
>>> 
>> 
>> Best,
>> Lance
>>> Am 01.12.2014 um 17:52 schrieb Lance Andersen:
>>>> Hi all,
>>>> 
>>>> Looking for a review for this change to DriverManager to reduce the possibility on a deadlock on <clinit>. that I have been discussing with Mandy.
>>>> 
>>>> 
>>>> The change removes the static initializer block as well as the synchronized keyword from registerDriver.
>>>> 
>>>> The webrev can be found at http://cr.openjdk.java.net/%7Elancea/8060068/webrev.02/
>>>> 
>>>> 
>>>> Best,
>>>> Lance
>>>> 
>>>> 
>>>> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
>>>> Oracle Java Engineering
>>>> 1 Network Drive
>>>> Burlington, MA 01803
>>>> Lance.Andersen at oracle.com
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>> 
>> 
>> 
>> Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
>> Oracle Java Engineering
>> 1 Network Drive
>> Burlington, MA 01803
>> Lance.Andersen at oracle.com
>> 
>> 
>> 



Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
Lance.Andersen at oracle.com






More information about the core-libs-dev mailing list