commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Fabulich <...@fabulich.com>
Subject Re: [VOTE] Release of DbUtils 1.2 RC2
Date Wed, 11 Mar 2009 16:50:08 GMT
sebb wrote:

> Sorry, my last e-mail mentioned that QueryRunner was not thread-safe,
> but I did not provide a patch.

Dang; I skimmed through other classes looking for unsafe members but 
overlooked your main point.

> Or you could change the API further and insist that the DataSource is 
> provided at construction time; the variable could be then made final.

This is the right fix.  (In fact, in my haste I thought you'd already done 
it!)  We should change the API as necessary to make the class immutable.

> Two of the constructors would need to be removed as well.

No, you could just set the DataSource to "null" in the constructor; its 
Connection-less methods wouldn't work until you created a new object, but 
I think that's fine.

> SqlNullCheckedResultSet has many variables that cannot be made final, 
> but the Javadoc does not claim it is thread-safe.
>
> It could be made thread-safe by synchronizing (or making volatile) all 
> the variables, but this might be too much overhead. Depends whether this 
> class is likely to be used from multiple threads or not.

I would not attempt to synchronize this class, just leave it unsafe and 
let users synchronize.  We should document more explicitly that (unlike 
some other classes in DbUtils) it's unsafe.

-Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message