> I only briefly reviewd the code in PreparedStatement yeaterday with respect
> to the usage of the SimpleDateFormat, my comments :
>
> - Why the ThreadLocal usage, and not just syncronize on the same
> SimpleDateFormat ?
This won't scale. :o)
> - It seems to that the SimpleDateFormat is never modified after creation.
> Wouldn't this mean that we actually could assign the SimpleDateFormat
> object to a static member, so we only had to create the object once.
> Or is concurrent usage of SimpleDateFormat.format() unsafe ?
SimpleDateFormat.format() and SimpleDateFormat.parse() are not threadsafe,
I believe the relevant 'bug' is 4228335.
> I would prefer the latter if safe, as we would get less object creation and
> synchronization.
The latter is what we used to have until it became clear that it wasn't
threadsafe.
I think the ThreadLocal solution is the best one available in the
circumstances.
Michael xxx