Re: PGXAConnection ConnectionHandler equals bug

From: Florent Guillaume <fg(at)nuxeo(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: PGXAConnection ConnectionHandler equals bug
Date: 2011-10-17 17:34:38
Message-ID: CAF-4BpOC9W9_mUQuEYdGiMHD-hE6YDjbNPBhXGZzf4sSqEU6LQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Mon, Oct 17, 2011 at 7:28 PM, Kevin Grittner
<Kevin(dot)Grittner(at)wicourts(dot)gov> wrote:
> Florent Guillaume <fg(at)nuxeo(dot)com> wrote:
>> When you have a Connection coming from a XAConnection, the
>> equals() method doesn't work: conn.equals(conn) returns false.
>>
>> The reason is that it's a actually a wapper, a
>> org.postgresql.xa.PGXAConnection.ConnectionHandler, and its
>> invoke() method doesn't take into account the "equals" case to
>> unwrap the second argument as well if needed.
>
> Is the hashCode method OK?  (What affects equals usually affects
> hashCode, too.)

Yes, hashCode is delegated down the chain to the underlying
AbstractJdbc23PooledConnection.ConnectionHandler#invoke which has
consistent equals and hashCode.

Florent

--
Florent Guillaume, Director of R&D, Nuxeo
Open Source, Java EE based, Enterprise Content Management (ECM)
http://www.nuxeo.com   http://www.nuxeo.org   +33 1 40 33 79 87

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message John R Pierce 2011-10-18 23:42:42 jdbc tcpKeepAlive parameter
Previous Message Kevin Grittner 2011-10-17 17:28:35 Re: PGXAConnection ConnectionHandler equals bug