db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Matrigali <mikem_...@sbcglobal.net>
Subject Re: The values for XA_OK and XA_RDONLY
Date Tue, 03 Jan 2006 20:11:35 GMT
I think it is ok.  The code should not count on them having the same
values.  As Francois points out the caller should do the mapping from 
XATransactionController constants to XAResource constants.
Historically I believe the reason there is an "internal" and
"external" set of constants is one piece of code did not want to require
the XA interfaces to compile, while the the other piece could.  I could
be wrong, it was a long time ago.

I don't know if this still applies today.

Francois Orsini wrote:
> Well I see these as constants being defined as part of some interface(s) 
> (space), hence they should be de-referenced through the interface as it 
> is done within:
> 
> org.apache.derby.jdbc.EmbedXAConnection
> 
> [...]
>                 if (ret == XATransactionController.XA_OK) {
>                     tranState.isPrepared = true;
> 
>                     return XAResource.XA_OK;
>                 } else {
> 
>                     returnConnectionToResource(tranState, xid_im);
>                     return XAResource.XA_RDONLY;
>                 }
> [...]
> 
> Note the 2 returns which will get you what is defined in the specs. 
> hence no problem. It would be wrong to return 
> XATransactionController.XA_OK directly to the external caller above as 
> this last one depends on what's defined in XAResource as the public API. 
> If it is not done like above in other areas of the code, then we would 
> have a problem ;)
> 
> --francois
> 
> On 12/21/05, *Bernt M. Johnsen* <Bernt.Johnsen@sun.com 
> <mailto:Bernt.Johnsen@sun.com>> wrote:
> 
>      >>>>>>>>>>>> Bernt M. Johnsen wrote (2005-12-21
12:53:49):
>      > I find it strange (and poteontially dangerous) that
>      >
>      > org.apache.derby.iapi.store.access.XATransactionController
>      > defines (public) that XA_OK = 2 and XA_RDONLY = 1
> 
>     The same does org.apache.derby.iapi.store.raw.Transaction
> 
>      > while the XA spec, the JTA spec and javax.transaction.xa.XAException
>      > defines XA_OK = 0 and XA_RDONLY = 3
>      >
>      > does anyone have a reasonable explanation?
>      > --
>      > Bernt Marius Johnsen, Database Technology Group,
>      > Sun Microsystems, Trondheim, Norway
> 
> 
> 
>     --
>     Bernt Marius Johnsen, Database Technology Group,
>     Sun Microsystems, Trondheim, Norway
> 
> 
> 


Mime
View raw message