use of com.swiftmq.jms.XidImpl in project swiftmq-client by iitsoftware.
the class XAResourceImpl method toSwiftMQXid.
private XidImpl toSwiftMQXid(Xid xid) {
XidImpl rXid = null;
if (xid instanceof com.swiftmq.jms.XidImpl)
rXid = (XidImpl) xid;
else {
rXid = (XidImpl) xidMapping.get(xid);
if (rXid == null) {
rXid = new XidImpl(xid);
xidMapping.put(xid, rXid);
}
}
if (logWriter != null)
log(toString() + "/toSwiftMQXid, xid=" + xid + ", rXid=" + rXid);
return rXid;
}
use of com.swiftmq.jms.XidImpl in project swiftmq-client by iitsoftware.
the class XAResourceImpl method start.
public synchronized void start(Xid xid, int flags) throws XAException {
XidImpl sxid = toSwiftMQXid(xid);
XAResStartReply reply = null;
try {
reply = (XAResStartReply) session.request(new XAResStartRequest(dispatchId, sxid, flags));
} catch (Exception e) {
XAException ex = new XAException(e.toString());
ex.errorCode = XAException.XA_RBINTEGRITY;
throw ex;
}
if (!reply.isOk()) {
XAException ex = new XAException(reply.getException().getMessage());
ex.errorCode = reply.getErrorCode();
throw ex;
} else {
session.setCurrentTransaction((Object[]) xidContent.remove(sxid));
try {
session.session.assignLastMessage();
} catch (Exception e) {
XAException ex = new XAException(reply.getException().getMessage());
ex.errorCode = reply.getErrorCode();
throw ex;
}
}
}
use of com.swiftmq.jms.XidImpl in project swiftmq-client by iitsoftware.
the class XAResourceImpl method rollback.
public synchronized void rollback(Xid xid) throws XAException {
XidImpl sxid = toSwiftMQXid(xid);
xidMapping.remove(xid);
XAResRollbackReply reply = null;
try {
session.getSessionImpl().startRecoverConsumers();
// clear current transaction locally
xidContent.remove(sxid);
reply = (XAResRollbackReply) session.request(new XAResRollbackRequest(dispatchId, sxid));
} catch (Exception e) {
e.printStackTrace();
XAException ex = new XAException(e.toString());
ex.errorCode = XAException.XA_RBINTEGRITY;
throw ex;
}
if (reply.isOk()) {
session.getSessionImpl().endRecoverConsumers();
} else {
XAException ex = new XAException(reply.getException().getMessage());
ex.errorCode = reply.getErrorCode();
throw ex;
}
}
use of com.swiftmq.jms.XidImpl in project swiftmq-client by iitsoftware.
the class XAResourceImpl method toSwiftMQXid.
private XidImpl toSwiftMQXid(Xid xid) {
XidImpl rXid = null;
if (xid instanceof com.swiftmq.jms.XidImpl)
rXid = (XidImpl) xid;
else {
rXid = (XidImpl) xidMapping.get(xid);
if (rXid == null) {
rXid = new XidImpl(xid);
xidMapping.put(xid, rXid);
}
}
return rXid;
}
use of com.swiftmq.jms.XidImpl in project swiftmq-ce by iitsoftware.
the class PrepareLogRecordImpl method readContent.
void readContent(DataInput in) throws IOException {
valid = in.readBoolean();
preparationTime = in.readLong();
type = in.readInt();
queueName = in.readUTF();
globalTxId = new XidImpl();
globalTxId.readContent(in);
int size = in.readInt();
keyList = new ArrayList(size);
for (int i = 0; i < size; i++) {
keyList.add(readEntry(in));
}
}
Aggregations