RFR 8060068 : Remove the static initializer block from DriverManager

Lance Andersen lance.andersen at oracle.com
Mon Dec 1 20:39:48 UTC 2014


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






More information about the core-libs-dev mailing list