Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 5F3B91337BDD for ; Mon, 28 Mar 2011 23:19:18 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 07028-09 for ; Tue, 29 Mar 2011 02:19:09 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [173.230.139.50]) by mail.postgresql.org (Postfix) with ESMTP id E62D61337BDB for ; Mon, 28 Mar 2011 23:19:07 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by www.postnewspapers.com.au (Postfix) with ESMTP id 1AC73124; Mon, 28 Mar 2011 22:19:08 -0400 (EDT) X-Virus-Scanned: amavisd-new at postnewspapers.com.au.com Received: from www.postnewspapers.com.au ([127.0.0.1]) by localhost (www.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id TF4G592ldwSm; Mon, 28 Mar 2011 22:19:06 -0400 (EDT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id D2711123; Mon, 28 Mar 2011 22:19:05 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id D2F62AF4ED; Tue, 29 Mar 2011 10:19:04 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id fPmhKUuoH1nb; Tue, 29 Mar 2011 10:18:59 +0800 (WST) Received: from [10.1.1.5] (58-7-255-44.dyn.iinet.net.au [58.7.255.44]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id 3EF55AE4EF; Tue, 29 Mar 2011 10:18:59 +0800 (WST) Message-ID: <4D914191.8050103@postnewspapers.com.au> Date: Tue, 29 Mar 2011 10:18:57 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7 MIME-Version: 1.0 To: Dave Cramer CC: List Subject: Re: JDBC gripe list References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/101 X-Sequence-Number: 21656 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. -- Craig Ringer