Re: Connection.isValid(int timeout) implementation

From: Vlad Arkhipov <arhipov(at)dc(dot)baikal(dot)ru>
To: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Connection.isValid(int timeout) implementation
Date: 2012-06-09 02:28:53
Message-ID: 4FD2B4E5.6000404@dc.baikal.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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.

<xa-datasource jndi-name="java:/datasources/Test" pool-name="Test"
enabled="true" use-ccm="false">
<xa-datasource-property name="ServerName">server</xa-datasource-property>
<xa-datasource-property
name="DatabaseName">database</xa-datasource-property>
<driver>postgresql</driver>
<xa-pool>
<is-same-rm-override>false</is-same-rm-override>
<interleaving>false</interleaving>
<pad-xid>false</pad-xid>
<wrap-xa-resource>false</wrap-xa-resource>
</xa-pool>
<security>
<user-name>user</user-name>
<password>password</password>
</security>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</xa-datasource>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Ringer 2012-06-09 06:19:22 Re: Connection.isValid(int timeout) implementation
Previous Message Mike Charnoky 2012-06-08 19:46:20 Re: Hung JDBC connections