Re: JDBC gripe list

From: Vitalii Tymchyshyn <tivv00(at)gmail(dot)com>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: Dave Cramer <pg(at)fastcrypt(dot)com>, List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC gripe list
Date: 2011-03-29 08:36:18
Message-ID: 4D919A02.60607@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

29.03.11 05:18, Craig Ringer написав(ла):
> On 03/27/2011 11:14 PM, Dave Cramer wrote:
>> Adding to the list is statement timeout. I seem to recall the issue is
>> we do not want to spawn a thread for each statement which seems to be
>> the only way to do this. Alternatively we could use timers, but I
>> presume they just spawn threads as well.
>
> Timers can use one shared thread for all timers, either a generic
> timer thread provided by the JVM or (IMO better in this case) one
> dedicated to that timer pool. I think it'd be an ideal way to do it
> personally - the JDBC driver has several issues that'd be solvable by
> adding a single thread to use for various timers, etc.
>
> If there are concerns about the driver spawning a thread, it wouldn't
> be too tricky to make timer-requiring features conditional on a
> connection param, so if no connections that were going to use
> timer-based features were made, no thread would be spawned. Personally
> I don't think a single shared thread is worth worrying about, though.
> Have you *seen* the thread lists in a modern Java app? Threads are
> extremely low cost when idle, and are already heavily used throughout
> Java and the JVM.
Please note that you will get into problems with classloaders and
different containers. E.g. running a thread from classloader will
prevent this classloader to be GCd. Tomcat handles this (with a lot of
warnings), but it is not recommended practice. See
http://www.theserverside.com/discussions/thread.tss?thread_id=44353 or
http://stackoverflow.com/questions/533783/why-spawning-threads-in-j2ee-container-is-discouraged

Best regards, Vitalii Tymchyshyn

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Ringer 2011-03-29 10:11:51 Re: JDBC gripe list
Previous Message Samuel Gendler 2011-03-29 06:09:08 Re: Problems with Hibernate Discriminators and 9.0-801.jdbc4