summaryrefslogtreecommitdiff
path: root/qpid/java/client/src/main
diff options
context:
space:
mode:
authorArnaud Simon <arnaudsimon@apache.org>2008-05-28 15:12:31 +0000
committerArnaud Simon <arnaudsimon@apache.org>2008-05-28 15:12:31 +0000
commit1422bd4f2f5291143fc6781599e6de8aad3490a1 (patch)
treeacb561f0dc21f36e60816e8635d1de097fbd77f8 /qpid/java/client/src/main
parent831649f6424871791fa5fac2a5a7403cf4ae45e9 (diff)
downloadqpid-python-1422bd4f2f5291143fc6781599e6de8aad3490a1.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@660973 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/src/main')
-rw-r--r--qpid/java/client/src/main/java/org/apache/qpid/client/XAResourceImpl.java36
1 files changed, 34 insertions, 2 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/XAResourceImpl.java b/qpid/java/client/src/main/java/org/apache/qpid/client/XAResourceImpl.java
index 27ec445436..7a107d748b 100644
--- a/qpid/java/client/src/main/java/org/apache/qpid/client/XAResourceImpl.java
+++ b/qpid/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,