I'd suggest marking it volatile or making it an immutable property. the
overhead incurred from enforcing thread safety i think is a bit much for the
specific purpose of the QueryRunner -- in all the instances that you
mentioned -- it's the datasource that should be dispatched to threads not
the qu
On 15/03/2009, Dan Fabulich wrote:
> sebb wrote:
>
>
> > OK, I'd not noticed that the class was usable without the DataSource.
> >
> > Of course the alternative is to document the class as thread-unsafe...
> >
>
> I would guess that the reason we've never seen a bug filed on this issue is
> that
sebb wrote:
OK, I'd not noticed that the class was usable without the DataSource.
Of course the alternative is to document the class as thread-unsafe...
I would guess that the reason we've never seen a bug filed on this issue
is that nobody uses setDataSource after the class is created. For
+1, all tests pass now also on IBM JDK 6.
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 Db
On 11/03/2009, Dan Fabulich wrote:
> 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
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 a
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 sy