Re: Patch for JDBC timestamp problems

Поиск
Список
Период
Сортировка
От Richard Bullington-McGuire
Тема Re: Patch for JDBC timestamp problems
Дата
Msg-id Pine.LNX.4.10.10101171823180.27489-100000@polymorphic.microstate.com
обсуждение исходный текст
Ответ на Patch for JDBC timestamp problems  (Barry Lind <barry@xythos.com>)
Список pgsql-patches
I've been reading the recent patch messages for issues related to the JDBC
driver, and I read this notice:

> In fixing the above two bugs, I noticed some things that could be
> improved.  In PreparedStatement.setTimestamp(),
> PreparedStatement.setDate(), ResultSet.getTimestamp(), and
> ResultSet.getDate() these methods were creating a new SimpleDateFormat
> object everytime they were called.  To avoid this unnecessary object
> creation overhead, I changed the code to use static variables for
> keeping a single instance of the needed formating objects.

In fact, the SimpleDateFormat class is not threadsafe, and you do need to
instantiate a new SimpleDateFormat for each pass through the thread. It is
more efficient to have a static instance; unfortunately, it is not
correct. It is desirable to centralize the creation of each type of
DateFormat, but the way to do it is a series of getMyDateFormat() calls
that instantiate a new instance of the variety of SimpleDateFormat you
want to get.

See
<http://developer.java.sun.com/developer/bugParade/bugs/4093418.html> for
details (this requires registration with the Sun Developer Connection).

--
 Richard Bullington-McGuire  <rbulling@microstate.com>
 Chief Technology Officer, The Microstate Corporation
 Phone: 703-796-6446  URL: http://www.microstate.com/
 PGP key IDs:    RSA: 0x93862305   DH/DSS: 0xDAC3028E



В списке pgsql-patches по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: docs: syntax.sgml patch
Следующее
От: Gunnar R|nning
Дата:
Сообщение: Re: Fixes and enhancements to JDBC driver (take 2)