// keep track for producer txn log
pLogRecordByteCount += ref.getSize();
pLogMsgList.add(ref.getPacket().getBytes());
}
Destination d = Destination.getDestination(ref.getDestinationUID());
if (fi.FAULT_INJECTION) {
fi.checkFaultAndExit(FaultInjection.FAULT_TXN_COMMIT_1_6, null, 2, false);
}
Set s = d.routeNewMessage(ref);
d.forwardMessage(s,ref);
} catch (Exception ex) {
logger.logStack((BrokerStateHandler.shuttingDown? Logger.DEBUG : Logger.ERROR),BrokerResources.E_INTERNAL_BROKER_ERROR, "unable to route/send transaction message " + sysid , ex);
}
}
boolean processDone = true;
// handle consumer transaction
int cLogRecordCount = 0;
ArrayList cLogDstList = null;
ArrayList cLogMsgList = null;
ArrayList cLogIntList = null;
HashMap remoteNotified = new HashMap();
if (cmap != null && cmap.size() > 0) {
Iterator itr = cmap.entrySet().iterator();
while (itr.hasNext()) {
Map.Entry entry = (Map.Entry)itr.next();
SysMessageID sysid = (SysMessageID)entry.getKey();
// CANT just pull from connection
if (sysid == null) continue;
PacketReference ref = Destination.get(sysid);
if (ref == null || ref.isDestroyed() || ref.isInvalid()) {
// already been deleted .. ignore
continue;
}
Destination dst =
Destination.getDestination(ref.getDestinationUID());
List interests = (List) entry.getValue();
for (int i = 0; i < interests.size(); i ++) {
ConsumerUID intid = (ConsumerUID) interests.get(i);
ConsumerUID sid = (ConsumerUID)sToCmap.get(intid);
if (sid == null) sid = intid;
try {
Session s = Session.getSession(intid);
if (s != null) {
PacketReference r1 = null;
if (fi.FAULT_INJECTION && fi.checkFault(
FaultInjection.FAULT_TXN_COMMIT_1_7_1, null)) {
Globals.getConnectionManager().getConnection(
s.getConnectionUID()).destroyConnection(
true, GoodbyeReason.OTHER,
"Fault injection of closing connection");
}
r1 =s.ackMessage(intid, sysid, id, remoteNotified, true);
if (r1 != null) {
if (fi.FAULT_INJECTION) {
fi.checkFaultAndExit(FaultInjection.FAULT_TXN_COMMIT_1_7, null, 2, false);
}
dst.removeMessage(ref.getSysMessageID(),
RemoveReason.ACKNOWLEDGED);
} else {
s = Session.getSession(intid);
}
}
if (s == null) {
//OK the session has been closed, we need
// to retrieve the message and acknowledge it
// with the stored UID
try {
if (ref.acknowledged(intid, sid,
true, true, id, remoteNotified, true)) {
dst.removeMessage(ref.getSysMessageID(),
RemoveReason.ACKNOWLEDGED);
}
} catch (BrokerException ex) {
// XXX improve internal error
logger.log(Logger.WARNING,"Internal error", ex);
}
}
if (Globals.txnLogEnabled()) {
if (cLogDstList == null) {
cLogDstList = new ArrayList();
cLogMsgList = new ArrayList();
cLogIntList = new ArrayList();
}
// keep track for consumer txn log;
// ignore non-durable subscriber
if (!dst.isQueue() && !sid.shouldStore()) {
continue;
}
cLogRecordCount++;
cLogDstList.add(dst.getUniqueName());
cLogMsgList.add(sysid);
cLogIntList.add(sid);
}
} catch (Exception ex) {
processDone = false;