From: Craig Ringer <ringerc@ringerc.id.au>
To: Vlad Arkhipov <arhipov@dc.baikal.ru>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Connection.isValid(int timeout) implementation
Date: Sat, 09 Jun 2012 14:19:22 +0800
Message-ID: <4FD2EAEA.3010807@ringerc.id.au> (raw)
In-Reply-To: <4FD2B4E5.6000404@dc.baikal.ru>
References: <4FD1E2BE.8020800@dc.baikal.ru>
<4FD20186.8050807@ringerc.id.au>
<4FD2B4E5.6000404@dc.baikal.ru>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: ringerc@ringerc.id.au, arhipov@dc.baikal.ru
Subject: Re: Connection.isValid(int timeout) implementation
In-Reply-To: <4FD2EAEA.3010807@ringerc.id.au>
References: <4FD1E2BE.8020800@dc.baikal.ru> <4FD20186.8050807@ringerc.id.au> <4FD2B4E5.6000404@dc.baikal.ru> <4FD2EAEA.3010807@ringerc.id.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox