Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 6F585CBE9C5 for ; Thu, 15 Dec 2011 16:48:58 -0400 (AST) Received: from static-ip-217-118-26-141.inaddr.ip-pool.com ([217.118.26.141] helo=mail.softperience.eu) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RbIEa-0001pd-TC for pgsql-jdbc@postgresql.org; Thu, 15 Dec 2011 20:48:58 +0000 Received: from mail.softperience.eu (loft2296 [217.118.26.141]) by mail.softperience.eu (Postfix) with ESMTPA id 9EB26C00035; Thu, 15 Dec 2011 21:48:43 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Date: Thu, 15 Dec 2011 21:48:43 +0100 From: =?UTF-8?Q?Rados=C5=82aw_Smogura?= To: Craig Ringer Cc: David Fetter , Sylvain Mougenot , Subject: Re: Re: [SQL] JDBC Statement.setQueryTimeout : is there plan to implement =?UTF-8?Q?this=3F?= In-Reply-To: <4EE9FE03.7070107@ringerc.id.au> References: <4EE8AC41.2040505@ringerc.id.au> <20111214161349.GA31176@fetter.org> <4EE968FF.5010604@ringerc.id.au> <4EE97B85.50909@ringerc.id.au> <4EE9FE03.7070107@ringerc.id.au> Message-ID: X-Sender: rsmogura@softperience.eu User-Agent: Roundcube Webmail/0.5.4 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201112/65 X-Sequence-Number: 22519 On Thu, 15 Dec 2011 22:02:43 +0800, Craig Ringer wrote: > On 12/15/2011 07:29 PM, Rados=C5=82aw Smogura wrote: >> Long, long time ago I've sent implementation with timers, you need=20 >> to search archive If you need this. > > If it was ages ago, you probably used java.util.Timer, right? > > java.util.Timer is not suitable for use in a JDBC driver because it > doesn't do any exception handling on the timer thread, it's subject=20 > to > congestion on the timer thread, and it offers no way for the driver=20 > to > control the timer thread to cleanly shut it down during unload. It's > unusable in app servers and not really a great idea anywhere that > needs to be robust and long-running. > > -- > Craig Ringer Indeed it was Timer with subclassed TimerTask. In any way=20 implementation was that it was prepared for choosing per connection (and=20 per connection is used during normal execution), per data source, or per=20 class loader (this is used in case of data sources). For shutting down implementation is clear thread associated with Timer=20 will go away if no more tasks are scheduled and there is no more=20 references to Timer. Demonizing timer is quite enough. From implementation if I recall well I used a little bit different=20 concept to create "atomic" operations chain for query executor protected=20 in addition with timer - and I think this concept was fully realized. Regards, Rados=C5=82aw Smogura