Re: jdbc xa patches

From: Vadim Nasardinov <vadimn(at)redhat(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: jdbc xa patches
Date: 2005-07-27 23:00:39
Message-ID: 200507271900.39224.vadimn@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Wednesday 27 July 2005 18:37, Oliver Jowett wrote:
> > http://www.google.com/search?q=Java+typesafe+enum
>
> Shrug, the main reason for an enum-like pattern is to get type
> safety, but in this case there's only one field that ever uses the
> enum (and it's never passed around as a parameter), so there's not
> much scope for getting it wrong.

Sure, you can get it right without the added benefit of type safety,
given that the offending piece of code is completely isolated within a
single file. (Both TransactionState and ResourceAssociationState are
private inner classes of PGXAResource.) It's a matter of taste and I
have no vested interest in the outcome of this particular
mini-discussion.

That said, from my cursory reading of
org/postgresql/xa/PGXAResource.java, it seems to me that both
TransactionState and ResourceAssociationState instances are used as
values in a Map. If we replace these two classes with "bare ints"
without changing the rest of the code drastically, we will have to box
those ints into Integers or suchlike before putting them into their
respective maps. It's not then a huge leap to turn those Integers
into proper typesafe enums, as is currently done. Seems very
reasonable to me, when viewed on its own merits. If, however, this
goes against some established pgjdbc prejudice against typesafe enums,
then sure, nuke it. Better be globally consistent, than locally
correct.

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-07-27 23:10:15 Re: jdbc xa patches
Previous Message Oliver Jowett 2005-07-27 22:59:11 Re: Date problem on Aix jdk1.4.1