Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 2E28E1EA2927 for ; Sat, 9 Jun 2012 03:19:50 -0300 (ADT) Received: from mail-pb0-f46.google.com ([209.85.160.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SdF1U-0004bL-89 for pgsql-jdbc@postgresql.org; Sat, 09 Jun 2012 06:19:49 +0000 Received: by pbbrp8 with SMTP id rp8so3408135pbb.19 for ; Fri, 08 Jun 2012 23:19:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:x-gm-message-state; bh=IPPcM7Utp93pHBO1AyS8fGogCsy6UY/2fZ8I55bACCY=; b=Ff0zucJ1UBWJuNtCK+663r+hnaNVBjSDue8rwNK7S9yaU9s/YYzL7eHS30Dg+lyucF UDfcMsLFzpZMXzyFBUKmfnH5XCRzAXKDy/zeMNsrx7gyWyrgMsZVqV4F+1fv81faI+8m lMiH6M5+QJWmbX3x1aDKBISEXWJnNF4CX0HmQ5LDHgslM47TLpxR03mcB0R5nxP8eX1c 7Ws+4ueQwa4R5As/lmOQMY1+6iDfXCMx7xr1sGSeXYSLqisa72oZprXa3Zq4WDgmVxHa HPWEu6SiKfOsFFieGGLxkJ7ZshB4OvDsE94RjMYxlX/mUP3ST6Lm4uy8XEA5eUH4j6fS 6Yxg== Received: by 10.68.224.233 with SMTP id rf9mr2864377pbc.141.1339222768380; Fri, 08 Jun 2012 23:19:28 -0700 (PDT) Received: from ayaki.localdomain (203-59-174-91.dyn.iinet.net.au. [203.59.174.91]) by mx.google.com with ESMTPS id wk3sm10401575pbc.21.2012.06.08.23.19.25 (version=SSLv3 cipher=OTHER); Fri, 08 Jun 2012 23:19:27 -0700 (PDT) Message-ID: <4FD2EAEA.3010807@ringerc.id.au> Date: Sat, 09 Jun 2012 14:19:22 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Vlad Arkhipov CC: pgsql-jdbc@postgresql.org Subject: Re: Connection.isValid(int timeout) implementation References: <4FD1E2BE.8020800@dc.baikal.ru> <4FD20186.8050807@ringerc.id.au> <4FD2B4E5.6000404@dc.baikal.ru> In-Reply-To: <4FD2B4E5.6000404@dc.baikal.ru> Content-Type: multipart/alternative; boundary="------------040504000604070406080205" X-Gm-Message-State: ALoCoQkEzz6/0kTw+s41h9gON3m70moso17UFOBZzNrVtsTvk+9Gql0RtF9H881MRyBbhSCmCCwt X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/37 X-Sequence-Number: 23031 This is a multi-part message in MIME format. --------------040504000604070406080205 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 06/09/2012 10:28 AM, Vlad Arkhipov wrote: > On 06/08/2012 10:43 PM, Craig Ringer wrote: >> On 06/08/2012 07:32 PM, Vlad Arkhipov wrote: >>> The current PostgreSQL driver (9.1-904) does not contain an >>> implementation of JDBC4 method Connection.isValid(int timeout). >> >> Looks like it's since been implemented. It was commited by Dave >> Cramer on 2012-01-19 in commit 773f8e45, based on a patch by Louis >> Flores. >> > Found it on master branch. Thank you. > >>> However there are some projects that strongly rely on this method to >>> test the >>> connection (for example Arjuna Transaction Manager that is used by >>> JBoss >>> Application Server). Are there any plans of implementing this feature? >> >> Really? JBoss AS 7.1.1.Final is quite happy with PgJDBC >> (postgresql-9.1-901-1.jdbc4.jar) here. What's your configuration? >> Your -ds.xml or jboss-cli "create datasource" command? > They have a memory leak in JTS 4.16.4 (JBoss AS 7.1.1), so if you use > XA datasource and the driver does not implement Connection.isValid, > Transaction Manager will create and store in memory a new XA > connection every 2 minutes. Good to know. Please post the reference to the JBoss JIRA ticket - assuming, as it sounds like, you're referring to an acknowledged bug. It sounds like it'll be important to make sure that isValid() makes it into the 9.2 JDBC driver release. Re your -ds.xml, does setting an explicit connection validator help? Otherwise I think it'll use org.jboss.jca.adapters.jdbc.extensions.novendor.JDBC4ValidConnectionChecker, which I expect won't work without isValid(). -- Craig Ringer --------------040504000604070406080205 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 06/09/2012 10:28 AM, Vlad Arkhipov wrote:
On 06/08/2012 10:43 PM, Craig Ringer wrote:
On 06/08/2012 07:32 PM, Vlad Arkhipov wrote:
The current PostgreSQL driver (9.1-904) does not contain an
implementation of JDBC4 method Connection.isValid(int timeout).

Looks like it's since been implemented. It was commited by Dave Cramer on 2012-01-19 in commit 773f8e45, based on a patch by Louis Flores.

Found it on master branch. Thank you.

However there are some projects that strongly rely on this method to test the
connection (for example Arjuna Transaction Manager that is used by JBoss
Application Server). Are there any plans of implementing this feature?

Really? JBoss AS 7.1.1.Final is quite happy with PgJDBC (postgresql-9.1-901-1.jdbc4.jar) here. What's your configuration? Your -ds.xml or jboss-cli "create datasource" command?
They have a memory leak in JTS 4.16.4 (JBoss AS 7.1.1), so if you use XA datasource and the driver does not implement Connection.isValid, Transaction Manager will create and store in memory a new XA connection every 2 minutes.

Good to know. Please post the reference to the JBoss JIRA ticket - assuming, as it sounds like, you're referring to an acknowledged bug.

It sounds like it'll be important to make sure that isValid() makes it into the 9.2 JDBC driver release.

Re your -ds.xml, does setting an explicit connection validator help?

<validation>     
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"></valid-connection-checker>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"></exception-sorter>
</validation>


Otherwise I think it'll use org.jboss.jca.adapters.jdbc.extensions.novendor.JDBC4ValidConnectionChecker, which I expect won't work without isValid().

--
Craig Ringer
--------------040504000604070406080205--