Search in sources :

Example 16 with XidImpl

use of com.swiftmq.jms.XidImpl in project swiftmq-client by iitsoftware.

the class XAResRecoverReply method writeContent.

public void writeContent(DataOutput out) throws IOException {
    super.writeContent(out);
    if (xids != null) {
        out.writeBoolean(true);
        out.writeInt(xids.size());
        for (int i = 0; i < xids.size(); i++) {
            XidImpl b = (XidImpl) xids.get(i);
            b.writeContent(out);
        }
    } else
        out.writeBoolean(false);
    out.writeInt(errorCode);
}
Also used : XidImpl(com.swiftmq.jms.XidImpl)

Example 17 with XidImpl

use of com.swiftmq.jms.XidImpl in project swiftmq-ce by iitsoftware.

the class RecoveryReplyRequest method readContent.

public void readContent(DataInput input) throws IOException {
    super.readContent(input);
    int size = input.readInt();
    if (size > 0) {
        xidList = new ArrayList();
        for (int i = 0; i < size; i++) {
            XidImpl xid = new XidImpl();
            xid.readContent(input);
            xidList.add(xid);
        }
    }
}
Also used : XidImpl(com.swiftmq.jms.XidImpl) ArrayList(java.util.ArrayList)

Example 18 with XidImpl

use of com.swiftmq.jms.XidImpl in project swiftmq-ce by iitsoftware.

the class RollbackReplyRequest method readContent.

public void readContent(DataInput input) throws IOException {
    super.readContent(input);
    xid = new XidImpl();
    xid.readContent(input);
}
Also used : XidImpl(com.swiftmq.jms.XidImpl)

Example 19 with XidImpl

use of com.swiftmq.jms.XidImpl in project swiftmq-ce by iitsoftware.

the class RollbackRequest method readContent.

public void readContent(DataInput input) throws IOException {
    super.readContent(input);
    xid = new XidImpl();
    xid.readContent(input);
}
Also used : XidImpl(com.swiftmq.jms.XidImpl)

Example 20 with XidImpl

use of com.swiftmq.jms.XidImpl in project swiftmq-ce by iitsoftware.

the class XADeliveryStage method close.

public void close() {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/close ...");
    super.close();
    closed = true;
    if (notificationList.size() > 0) {
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/close, final notify ...");
        for (Iterator iter = notificationList.entrySet().iterator(); iter.hasNext(); ) {
            Map.Entry entry = (Map.Entry) iter.next();
            DeliveryRequest dr = (DeliveryRequest) entry.getValue();
            if (ctx.traceSpace.enabled)
                ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/close, final notify: " + dr);
            dr.callback.delivered(dr);
        }
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/close, final notify done");
        notificationList.clear();
    }
    if (outboundTransactions.size() > 0) {
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/close, passing prepared outbound tx to XAResourceManager ...");
        for (Iterator iter = outboundTransactions.entrySet().iterator(); iter.hasNext(); ) {
            try {
                Map.Entry entry = (Map.Entry) iter.next();
                XidImpl xid = (XidImpl) entry.getKey();
                XAContext xac = ctx.xaResourceManagerSwiftlet.createXAContext(xid);
                int id = xac.register(toString());
                QueuePullTransaction t = (QueuePullTransaction) entry.getValue();
                xac.addTransaction(id, t.getQueueName(), t);
                xac.unregister(id, false);
                xac.setPrepared(true);
            } catch (XAContextException e) {
                ctx.logSwiftlet.logError(ctx.routingSwiftlet.getName(), toString() + "/close, passing prepared outbound tx to XAResourceManager, exception: " + e);
            }
        }
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/close, passing prepared outbound tx to XAResourceManager done");
        outboundTransactions.clear();
    }
    if (inboundTransactions.size() > 0) {
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/close, passing prepared inbound tx to XAResourceManager ...");
        for (Iterator iter = inboundTransactions.entrySet().iterator(); iter.hasNext(); ) {
            ((Tx) ((Map.Entry) iter.next()).getValue()).handOver();
        }
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace(ctx.routingSwiftlet.getName(), toString() + "/close, passing prepared inbound tx to XAResourceManager done");
    }
    for (Iterator iter = producers.entrySet().iterator(); iter.hasNext(); ) {
        QueueSender sender = (QueueSender) ((Map.Entry) iter.next()).getValue();
        try {
            sender.close();
        } catch (Exception e) {
        }
    }
    producers.clear();
    for (Iterator iter = consumers.entrySet().iterator(); iter.hasNext(); ) {
        QueueReceiver receiver = (QueueReceiver) ((Map.Entry) iter.next()).getValue();
        try {
            receiver.close();
        } catch (Exception e) {
        }
    }
    consumers.clear();
    if (throttleQueue != null)
        throttleQueue.close();
    visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.SMQRFactory.START_STAGE_REQ, null);
    visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.SMQRFactory.SEND_ROUTE_REQ, null);
    visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.SMQRFactory.DELIVERY_REQ, null);
    visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.v942.SMQRFactory.ROUTE_REQ, null);
    visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.v942.SMQRFactory.ADJUST_REQ, null);
    visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.v942.SMQRFactory.TRANSACTION_REQ, null);
    visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.v942.SMQRFactory.COMMIT_REQ, null);
    visitor.setRequestHandler(com.swiftmq.impl.routing.single.smqpr.v942.SMQRFactory.COMMIT_REPREQ, null);
}
Also used : XAContext(com.swiftmq.swiftlet.xa.XAContext) XidImpl(com.swiftmq.jms.XidImpl) QueuePullTransaction(com.swiftmq.swiftlet.queue.QueuePullTransaction) JMSException(javax.jms.JMSException) XAContextException(com.swiftmq.swiftlet.xa.XAContextException) QueueSender(com.swiftmq.swiftlet.queue.QueueSender) QueueReceiver(com.swiftmq.swiftlet.queue.QueueReceiver) XAContextException(com.swiftmq.swiftlet.xa.XAContextException)

Aggregations

XidImpl (com.swiftmq.jms.XidImpl)85 XAException (javax.transaction.xa.XAException)37 JMSException (javax.jms.JMSException)28 ValidationException (com.swiftmq.tools.requestreply.ValidationException)22 Request (com.swiftmq.tools.requestreply.Request)16 List (java.util.List)12 ArrayList (java.util.ArrayList)10 XAContextException (com.swiftmq.swiftlet.xa.XAContextException)9 MessageImpl (com.swiftmq.jms.MessageImpl)6 XAContext (com.swiftmq.swiftlet.xa.XAContext)5 QueuePullTransaction (com.swiftmq.swiftlet.queue.QueuePullTransaction)4 QueueReceiver (com.swiftmq.swiftlet.queue.QueueReceiver)4 QueueSender (com.swiftmq.swiftlet.queue.QueueSender)4 BytesMessageImpl (com.swiftmq.jms.BytesMessageImpl)2 QueuePushTransaction (com.swiftmq.swiftlet.queue.QueuePushTransaction)2 Comparator (java.util.Comparator)2 CommitRequest (com.swiftmq.impl.routing.single.smqpr.v400.CommitRequest)1 CommitRequest (com.swiftmq.impl.routing.single.smqpr.v942.CommitRequest)1 QueueImpl (com.swiftmq.jms.QueueImpl)1 Entity (com.swiftmq.mgmt.Entity)1