use of com.swiftmq.jms.smqp.v610.RollbackReply in project swiftmq-ce by iitsoftware.
the class TransactedSession method visit.
public void visit(RollbackRequest req) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitRollbackRequest");
recoveryInProgress = true;
RollbackReply reply = (RollbackReply) req.createReply();
reply.setRecoveryEpoche(req.getRecoveryEpoche());
reply.setOk(true);
for (int i = 0; i < consumerList.size(); i++) {
Consumer consumer = (Consumer) consumerList.get(i);
if (consumer != null) {
try {
MessageProcessor mp = consumer.getMessageProcessor();
if (mp != null) {
mp.stop();
consumer.getReadTransaction().unregisterMessageProcessor(mp);
}
consumer.getReadTransaction().rollback();
} catch (Exception e) {
reply.setOk(false);
reply.setException(e);
break;
}
}
}
GenericRequest gr = new GenericRequest(-1, false, reply);
ctx.sessionQueue.enqueue(gr);
}
use of com.swiftmq.jms.smqp.v610.RollbackReply in project swiftmq-ce by iitsoftware.
the class TransactedSession method visitGenericRequest.
public void visitGenericRequest(GenericRequest request) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitGenericRequest/RollbackReply");
RollbackReply reply = (RollbackReply) request.getPayload();
recoveryEpoche = reply.getRecoveryEpoche();
try {
transactionManager.rollback(false);
purgeMarkedProducers();
purgeMarkedConsumers();
for (int i = 0; i < consumerList.size(); i++) {
Consumer consumer = (Consumer) consumerList.get(i);
if (consumer != null) {
consumer.createReadTransaction();
AsyncMessageProcessor mp = (AsyncMessageProcessor) consumer.getMessageProcessor();
if (mp != null) {
mp = new AsyncMessageProcessor(this, ctx, consumer, mp.getConsumerCacheSize(), recoveryEpoche);
consumer.setMessageListener(consumer.getClientDispatchId(), consumer.getClientListenerId(), mp);
mp.register();
}
}
}
transactionManager.startTransactions();
} catch (Exception e) {
reply.setOk(false);
reply.setException(e);
}
recoveryInProgress = false;
reply.send();
}
use of com.swiftmq.jms.smqp.v610.RollbackReply in project swiftmq-ce by iitsoftware.
the class TransactedSession method visit.
public void visit(RollbackRequest req) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitRollbackRequest");
recoveryInProgress = true;
RollbackReply reply = (RollbackReply) req.createReply();
reply.setOk(true);
for (int i = 0; i < consumerList.size(); i++) {
Consumer consumer = (Consumer) consumerList.get(i);
if (consumer != null) {
try {
MessageProcessor mp = consumer.getMessageProcessor();
if (mp != null) {
mp.stop();
consumer.getReadTransaction().unregisterMessageProcessor(mp);
}
consumer.getReadTransaction().rollback();
} catch (Exception e) {
reply.setOk(false);
reply.setException(e);
break;
}
}
}
GenericRequest gr = new GenericRequest(-1, false, reply);
ctx.sessionQueue.enqueue(gr);
}
use of com.swiftmq.jms.smqp.v610.RollbackReply in project swiftmq-ce by iitsoftware.
the class TransactedSession method visitRollbackRequest.
public void visitRollbackRequest(RollbackRequest req) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitRollbackRequest");
recoveryInProgress = true;
RollbackReply reply = (RollbackReply) req.createReply();
reply.setOk(true);
for (int i = 0; i < consumerList.size(); i++) {
Consumer consumer = (Consumer) consumerList.get(i);
if (consumer != null) {
try {
MessageProcessor mp = consumer.getMessageProcessor();
if (mp != null) {
mp.stop();
consumer.getReadTransaction().unregisterMessageProcessor(mp);
}
consumer.getReadTransaction().rollback();
} catch (Exception e) {
reply.setOk(false);
reply.setException(new javax.jms.JMSException(e.toString()));
break;
}
}
}
GenericRequest gr = new GenericRequest(-1, false, reply);
ctx.sessionQueue.enqueue(gr);
}
use of com.swiftmq.jms.smqp.v610.RollbackReply in project swiftmq-ce by iitsoftware.
the class TransactedSession method visitGenericRequest.
public void visitGenericRequest(GenericRequest request) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitGenericRequest/RollbackReply");
RollbackReply reply = (RollbackReply) request.getPayload();
recoveryEpoche++;
try {
transactionManager.rollback(false);
purgeMarkedProducers();
purgeMarkedConsumers();
for (int i = 0; i < consumerList.size(); i++) {
Consumer consumer = (Consumer) consumerList.get(i);
if (consumer != null) {
consumer.createReadTransaction();
AsyncMessageProcessor mp = (AsyncMessageProcessor) consumer.getMessageProcessor();
if (mp != null) {
mp = new AsyncMessageProcessor(this, ctx, consumer, mp.getConsumerCacheSize(), recoveryEpoche);
consumer.setMessageListener(consumer.getClientDispatchId(), consumer.getClientListenerId(), mp);
consumer.getReadTransaction().registerMessageProcessor(mp);
}
}
}
transactionManager.startTransactions();
} catch (Exception e) {
reply.setOk(false);
reply.setException(new javax.jms.JMSException(e.toString()));
}
recoveryInProgress = false;
reply.send();
}
Aggregations