use of com.swiftmq.tools.requestreply.GenericRequest 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.tools.requestreply.GenericRequest in project swiftmq-ce by iitsoftware.
the class NontransactedSession method visit.
public void visit(RecoverSessionRequest req) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitRecoverSessionRequest");
recoveryInProgress = true;
RecoverSessionReply reply = (RecoverSessionReply) 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) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitRecoverSessionRequest, stopping message processor: " + mp);
mp.stop();
consumer.getReadTransaction().unregisterMessageProcessor(mp);
}
consumer.getReadTransaction().rollback();
consumer.getTransaction().rollback();
} catch (Exception e) {
reply.setOk(false);
reply.setException(e);
break;
}
}
}
deliveredList.clear();
GenericRequest gr = new GenericRequest(-1, false, reply);
ctx.sessionQueue.enqueue(gr);
}
use of com.swiftmq.tools.requestreply.GenericRequest 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.tools.requestreply.GenericRequest in project swiftmq-ce by iitsoftware.
the class JMSConnection method close.
public void close() {
inboundReader.setClosed(true);
connectionQueue.enqueue(new GenericRequest(0, false, null));
}
use of com.swiftmq.tools.requestreply.GenericRequest 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