You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Daniel John Debrunner <dj...@apache.org> on 2006/02/22 02:18:33 UTC
NetXAResource - duplicate constants?
Anyone have any idea why the client's NetXAResource has its own version
of XA return value constants, that seem to have the same value as the
constants in javax.transaction.xa.XAException?
Thanks,
Dan.
org.apache.derby.client.net.NetXAResource
// xaretval defines
public static final int XARETVAL_XALCSNOTSUPP = 99; // Loosely
Coupled Not Supported
public static final int XARETVAL_RBROLLBACK = 100; // Rollback
public static final int XARETVAL_RBCOMMFAIL = 101; // Rollback
Communication Failure
public static final int XARETVAL_RBDEADLOCK = 102; // Rollback Deadlock
public static final int XARETVAL_RBINTEGRITY = 103; // Rollback
integrity violation
public static final int XARETVAL_RBOTHER = 104; // Rollback Other
public static final int XARETVAL_RBPROTO = 105; // Rollback Protocol
public static final int XARETVAL_RBTIMEOUT = 106; // Rollback Timeout
public static final int XARETVAL_RBTRANSIENT = 107; // Rollback
Transaction branch
public static final int XARETVAL_NODISSOCIATE = 108; // Unable to
Dissociate resources from connection
public static final int XARETVAL_XATWOPHASE = 13; // TwoPhase commit
required
public static final int XARETVAL_XAPROMOTED = 12; // Promoted - unused
public static final int XARETVAL_XADEFERRED = 11; // Deferred - unused
public static final int XARETVAL_XACOMMFAIL = 10; // Communication
Failure
public static final int XARETVAL_XANOMIGRATE = 9; // No Migration
public static final int XARETVAL_XAHEURHAZ = 8; // Heuristically
completed
public static final int XARETVAL_XAHEURCOM = 7; // Heuristically
Commited
public static final int XARETVAL_XAHEURRB = 6; // Heuristically
Rolledback
public static final int XARETVAL_XAHEURMIX = 5; // Branch
heuristically commit and rollback
public static final int XARETVAL_XARETRY = 4; // Retry Commit
public static final int XARETVAL_XARDONLY = 3; // Read Only
public static final int XARETVAL_XAOK = 0; // OK
public static final int XARETVAL_XAERASYNC = -2; // Async Request
not possible
public static final int XARETVAL_XAERRMERR = -3; // RM Error
public static final int XARETVAL_XAERNOTA = -4; // XID does not exist
public static final int XARETVAL_XAERINVAL = -5; // Invalid arguments
public static final int XARETVAL_XAERPROTO = -6; // Protocol Violation
public static final int XARETVAL_XAERRMFAIL = -7; // RM Failed
public static final int XARETVAL_XAERDUPID = -8; // Duplicate XID
public static final int XARETVAL_XAEROUTSIDE = -9; // Local
tansaction active
public static final int XARETVAL_XAEROPENRES = -10; // Open resources
Re: NetXAResource - duplicate constants?
Posted by Bryan Pendleton <bp...@amberpoint.com>.
Daniel John Debrunner wrote:
> the client
> should not have its own set of constants, and instead just use the ones
> defined in XAException.
I agree. I had the same reaction when I was reading an early version
of the patch for DERBY-960: see
http://www.nabble.com/Re%3A-jira-Updated%3A-%28DERBY-960%29-Client-xa-prepare-returns-XA_OK-instead-of-XA_RDONLY-for-a-read-only-transaction-p2942222.html
XARETVAL_XARDONLY and XARETVAL_XAOK in NetXAResource.java seem to
duplicate the values XA_OK and XA_RDONLY from
http://java.sun.com/j2ee/1.4/docs/api/javax/transaction/xa/XAResource.html
+1 to simply using the constants defined in
javax.transaction.xa.XAException and javax.transaction.xa.XAResource
instead of defining duplicate constants in NetXAResource.java.
thanks,
bryan
Re: NetXAResource - duplicate constants?
Posted by Daniel John Debrunner <dj...@apache.org>.
Daniel John Debrunner wrote:
> Anyone have any idea why the client's NetXAResource has its own version
> of XA return value constants, that seem to have the same value as the
> constants in javax.transaction.xa.XAException?
Following the code more, the XA return value set in the code point
XARETVAL is obtained from the XAException.errorCode. Thus the client
should not have its own set of constants, and instead just use the ones
defined in XAException. This duplicate set of constants and the
conversion between the two (identical values) is actually responsible
for DERBY-1024. The bug is that the conversion code does not have a case
statement for the outside value, the server is returning the correct value.
Dan.