String msgId = msg.getIdentifier();
if (logger.isLoggable(BasicLevel.INFO))
logger.log(BasicLevel.INFO, " -> denying message: " + msgId);
sendNot(from, new DenyRequest(0, rep.getCorrelationId(), msgId));
}
}
} else {
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, " -> reply");
ConsumerMessages jRep;
// Building the reply and storing the wrapped message id for later
// denying in the case of a failure:
if (rep.getSize() > 0) {
jRep = new ConsumerMessages(rep.getCorrelationId(), rep.getMessages(), from.toString(), true);
activeCtx.addDeliveringQueue(from);
} else {
jRep = new ConsumerMessages(rep.getCorrelationId(), (Vector) null, from.toString(), true);
}
// If the context is started, delivering the message, or buffering it:
if (activeCtx.getActivated()) {
doReply(jRep);
} else {
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, " -> buffer the reply");
activeCtx.addPendingDelivery(jRep);
}
}
} catch (StateException pE) {
// The context is lost: denying the message:
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "", pE);
if (rep.getMessages().size() > 0) {
Vector msgList = rep.getMessages();
for (int i = 0; i < msgList.size(); i++) {
Message msg = new Message((org.objectweb.joram.shared.messages.Message) msgList.elementAt(i));
String msgId = msg.getIdentifier();
if (logger.isLoggable(BasicLevel.INFO))
logger.log(BasicLevel.INFO, "Denying message: " + msgId);
sendNot(from, new DenyRequest(0, rep.getCorrelationId(), msgId));
}
}
}
}