Re: org.postgresql.Driver not thread-safe

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: org.postgresql.Driver not thread-safe
Дата
Msg-id Pine.LNX.4.33.0311152014010.14784-200000@leary.csoft.net
обсуждение исходный текст
Ответ на org.postgresql.Driver not thread-safe  ("Karl von Randow" <karl@xk72.com>)
Ответы Re: org.postgresql.Driver not thread-safe  ("Karl von Randow" <karl@xk72.com>)
Список pgsql-jdbc

On Sun, 16 Nov 2003, Karl von Randow wrote:

> Hi all,
>
> It seems that org.postgresql.Driver isn't thread safe, as it stores details
> from the connection URL to the connect method in an instance variable
> "props" - and there is no synchronisation. The DriverManager
> (java.sql.DriverManager) returns the same instance of the
> org.postgresql.Driver to each getDriver(String url ) method and probably all
> of the others. Hence the problem with multiple threads connecting at the
> same time, the threads obtain the same Driver instance and the connection
> details from different threads can become muddled.

Yes, good catch.

> I've made a simple patch against the REL_7_3_STABLE branch of Driver.java.in
> which removes the use of the instance variable. I'm going to test this patch
> immediately.

In the future when submitting patches please use a context diff (-c)
format and attach it to the email so it avoids line wrapping.

Here is the corresponding patch against cvs tip which should also apply
cleanly to the 7.4 branch.

Kris Jurka


Вложения

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

Предыдущее
От: "Karl von Randow"
Дата:
Сообщение: org.postgresql.Driver not thread-safe
Следующее
От: "Karl von Randow"
Дата:
Сообщение: Re: org.postgresql.Driver not thread-safe