use of com.swiftmq.jms.smqp.v510.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) {
int maxBulkSize = (int) (mp.getMaxBulkSize() / 1024);
mp = new AsyncMessageProcessor(this, ctx, consumer, mp.getConsumerCacheSize(), recoveryEpoche);
mp.setMaxBulkSize(maxBulkSize);
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.v510.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(e);
}
recoveryInProgress = false;
reply.send();
}
use of com.swiftmq.jms.smqp.v510.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.v510.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);
}
Aggregations