[hibernate-dev] A framework JDBC code change suggestion...
Joseph Weinstein
joe at bea.com
Wed Dec 13 16:11:20 EST 2006
At 01:05 PM 12/13/2006, Max Rydahl Andersen wrote:
>Hi Joseph,
>
>It would probably be more relevant to report this to Spring since the
>code you are referring to is not within Hibernate.
>
>p.s. first time i've seen someone having to decompile opensource classes
>to fix things ;)
Thanks, I'm just flying by the seat of the pants, never looked
for the source. This must be clear how quick-and-dirty because I chose
the wrong dev group to talk to...
thanks
Joe
>/max
>
>>Hi all.
>>
>>In debugging a JDBC-related issue with hibernate and
>>WebLogic I found a file:
>>
>>org.springframework.jdbc.datasource.DriverManagerDataSource.
>>
>>There is a part of this file that hurts JDBC concurrency
>>in multithreaded applications like WebLogic, and I have a
>>solution. I would like to suggest a better alternative that
>>would probably be named DriverDataSource.
>> The problem is that *all* java.sql.DriverManager calls are
>>class-synchronized. This include getConnection() and some very
>>simple methods like DriverManager.println() which every driver
>>may be calling continually at runtime (whether or not there is
>>a DriverManager log stream). The constructor for SQLException
>>calls this method.
>> This means that one slow call to DriverManager.getConnection()
>>can temporarily block all other JDBC in the whole JVM. In some
>>cases we have even seen deadlocks where one thread that holds the
>>DriverManager lock calls another thread that wants to do JDBC.
>> The solution is to remove all calls to DriverManager.getConnection()
>>and replace them with a simple call to Driver.connect(). In fact,
>>this is what the DriverManager itself does, except that for every
>>getConnection() call, the DriverManager goes through it's list of
>>every registered driver in the JVM, trying each one with your URL
>>and properties until it finds one that doesn't throw an exception
>>and returns a connection. I decompiled and altered the
>>DriverManagerDataSource to do that, for a customer to try, and I
>>have attached it to this email as a suggestion for your consideration.
>>HTH,
>>Joe Weinstein at BEA
>>Systems_______________________________________________________________________
>>Notice: This email message, together with any attachments, may contain
>>information of BEA Systems, Inc., its subsidiaries and affiliated
>>entities, that may be confidential, proprietary, copyrighted and/or
>>legally privileged, and is intended solely for the use of the individual
>>or entity named in this message. If you are not the intended recipient,
>>and have received this message in error, please immediately return this
>>by email and then delete it.
>
>
>
>--
>--
>Max Rydahl Andersen
>callto://max.rydahl.andersen
>
>Hibernate
>max at hibernate.org
>http://hibernate.org
>
>JBoss a division of Red Hat
>max.andersen at jboss.com
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
More information about the hibernate-dev
mailing list