commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <>
Subject Re: [VOTE] Release of DbUtils 1.2 RC2
Date Wed, 11 Mar 2009 13:31:13 GMT
Sorry, my last e-mail mentioned that QueryRunner was not thread-safe,
but I did not provide a patch.

The DataSource variable is protected.

To allow multi-threaded access, either the variable has to be made
volatile, or it has to be made private (i.e. an API change) and the
accessors need to be synchronised, and the class has to use the

Or you could change the API further and insist that the DataSource is
provided at construction time; the variable could be then made final.
Two of the constructors would need to be removed as well.

There's another potential problem with QueryRunner, in that the
constructor calls an overrideable public method. This could cause
problems if the class is extended, as the subclass may not be fully
constructed when the method is invoked.

But an easy fix is to add a private set method used by both the
constructor and the public method.

I did not check the wrappers previously.

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.

On 11/03/2009, Dan Fabulich <> wrote:
>  My second attempt at releasing a commons project; please be gentle. :-)
>  RC2 includes sebb's patches that make numerous instance variables
> immutable.
>  NOTE: No one has yet explicitly said on-list that they have tested DbUtils
> 1.2 RC1 or RC2 with a real database.  We should not release it until
> somebody tries it out with a real live Oracle database, as described below.
>  Compatibility warnings:
>  * We upgraded the JVM dependency from JDK 1.3 to JDK 1.4 (DBUTILS-31)
>  * Users who may have extended BeanListHandler.handleRow will find that this
> method no longer exists (is no longer called) in DbUtils 1.2 (DBUTILS-37)
>  * Users who may have extended KeyedHandler will find that its protected
> members are now final (to guarantee thread safety). (DBUTILS-51)
>  Although this project has reasonable unit tests, it has no integration
> tests with any actual databases; it is quite possible that the fix for
> DBUTILS-31 has broken something on Oracle, MS SQL Server, Derby, or your
> favorite database.
>  To verify DBUTILS-31, use QueryRunner to put a null value in a field, e.g.
> with QueryRunner.update.  Ideally it would be good to verify putting nulls
> in fields of various types: char, varchar, int, boolean, date, etc.
>  --
>  Tag:
>  Site:
>  Binaries:
>  [ ] +1 release it
>  [ ] +0 go ahead I don't care
>  [ ] -1 no, do not release it because
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail:
>  For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message