OK, thanks, sounds good.

Dan, what's your status with this patch? As it stands your -1 is still holding it back.

David

Anurag Shekhar wrote:


- If I have this right, the exceptionFactory doesn't get initialized until the first instance of InternalDriver() is created. Isn't it possible that getExceptionFactory() will return null? Doesn't this mean that at some point during pre-boot I'll get a NullPointerException if I try to throw a SQLException? Is this something that could happen, or are all SQLExceptions guaranteed to be thrown only after at least one instance of InternalDriver has been created?
No the boot method is called from the static initializer of EmbeddedDriver, so the factory will get initialized when the driver class is loaded. I was under assumption that there is no situation which may cause SQLException before the driver is booted. Looking at the code it appears the SQLException is thrown only after the boot is successful and all the method coming in the execution chain of boot throw Standard Exception. Once the boot method is call the exception factory will be available to all the classes even if the boot fails.

Perhaps this is not an issue, but the pattern I proposed in my email does not have this potential timing bug, where the exception factory is created as part of the static initializer for the InternalDriver class. I also question whether it needs to be part of the InternalDriver at all, looking at the code, there appears to be no dependency on the data or behavior of InternalDriver. Usually for a singleton pattern like this you see something like this (independent from InternalDriver, and with no dependencies on boot timing):

I had used a similar approach in my first patch (checking for jvm version). But checking jvm info wasn't a good idea (its already been checked while loading the Driver), so Dan suggested to use the InternalDriver to get the correct Exception Factory. Using InternalDriver for getting the exception factory has added advantage of not using reflection to load and instantiate exception factory which I will need if I try to check jvm version and create ExceptionFactory for that version.

anurag
begin:vcard
fn:David W Van Couvering
n:Van Couvering;David W
org:Sun Microsystems, Inc.;Database Technology Group
email;internet:[EMAIL PROTECTED]
title:Senior Staff Software Engineer
tel;work:510-550-6819
tel;cell:510-684-7281
x-mozilla-html:TRUE
version:2.1
end:vcard

Reply via email to