diff options
| author | Arnaud Simon <arnaudsimon@apache.org> | 2008-05-28 15:12:31 +0000 |
|---|---|---|
| committer | Arnaud Simon <arnaudsimon@apache.org> | 2008-05-28 15:12:31 +0000 |
| commit | a01cfe5a6ad7fdd519e88d2dd3d3ebc1e96d2445 (patch) | |
| tree | 86e8b83abdee5c2eda188a6dbb5ad77e34d31b10 /java/client/src/main | |
| parent | ebbe86029e0648e6f27242a6320c472ea6a86e8f (diff) | |
| download | qpid-python-a01cfe5a6ad7fdd519e88d2dd3d3ebc1e96d2445.tar.gz | |
QPID-1094 and QPID-1095: Updated XaResource for handling wrong flag value, updated xa tests for using correct flag values, excluded forget test as the current 0.10 broker does not implement forget.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@660973 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src/main')
| -rw-r--r-- | java/client/src/main/java/org/apache/qpid/client/XAResourceImpl.java | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/java/client/src/main/java/org/apache/qpid/client/XAResourceImpl.java b/java/client/src/main/java/org/apache/qpid/client/XAResourceImpl.java index 27ec445436..7a107d748b 100644 --- a/java/client/src/main/java/org/apache/qpid/client/XAResourceImpl.java +++ b/java/client/src/main/java/org/apache/qpid/client/XAResourceImpl.java @@ -116,6 +116,17 @@ public class XAResourceImpl implements XAResource { _logger.debug("end tx branch with xid: ", xid); } + switch (flag) + { + case(XAResource.TMSUCCESS): + break; + case(XAResource.TMFAIL): + break; + case(XAResource.TMSUSPEND): + break; + default: + throw new XAException(XAException.XAER_INVAL); + } Future<XaResult> future = _xaSession.getQpidSession() .dtxEnd(convertXid(xid), flag == XAResource.TMFAIL ? Option.FAIL : Option.NO_OPTION, @@ -270,8 +281,18 @@ public class XAResourceImpl implements XAResource { // the flag is ignored Future<RecoverResult> future = _xaSession.getQpidSession().dtxRecover(); - RecoverResult res = future.get(); - // todo make sure that the keys of the returned map are the xids + RecoverResult res = null; + try + { + res = future.get(); + } + catch (SessionException e) + { + // we need to restore the qpidity session that has been closed + _xaSession.createSession(); + // we should get a single exception + convertExecutionErrorToXAErr( e.getExceptions().get(0).getErrorCode()); + } Xid[] result = new Xid[res.getInDoubt().size()]; int i = 0; for (Object obj : res.getInDoubt()) @@ -366,6 +387,17 @@ public class XAResourceImpl implements XAResource { _logger.debug("start tx branch with xid: ", xid); } + switch (flag) + { + case(XAResource.TMNOFLAGS): + break; + case(XAResource.TMJOIN): + break; + case(XAResource.TMRESUME): + break; + default: + throw new XAException(XAException.XAER_INVAL); + } Future<XaResult> future = _xaSession.getQpidSession() .dtxStart(convertXid(xid), flag == XAResource.TMJOIN ? Option.JOIN : Option.NO_OPTION, |
