}
boolean remoteStatus = false;
StringBuffer remoteConsumerUIDs = null;
List cleanList = null;
SysMessageID ids[] = null;
ConsumerUID cids[] = null;
try {
if (status == Status.OK) {
DataInputStream is = new DataInputStream(
msg.getMessageBodyStream());
// pull out the messages into two lists
ids = new SysMessageID[ackcount];
cids = new ConsumerUID[ackcount];
for (int i = 0; i < ackcount; i ++) {
long newid = is.readLong();
cids[i] = new ConsumerUID(newid);
cids[i].setConnectionUID(con.getConnectionUID());
ids[i] = new SysMessageID();
ids[i].readID(is);
}
if (JMQValidate) {
if (ackType == DEAD_REQUEST ||
ackType == UNDELIVERABLE_REQUEST) {
status = Status.BAD_REQUEST;
reason = "Can not use JMQValidate with ackType of "
+ ackType;
} else if (tid == null) {
status = Status.BAD_REQUEST;
reason = "Can not use JMQValidate with no tid ";
} else if (!validateMessages(tid, ids, cids)) {
status = Status.NOT_FOUND;
reason = "Acknowledgement not processed";
}
} else if (ackType == DEAD_REQUEST) {
cleanList = handleDeadMsgs(con, ids, cids, deadrs,
deadthr, deadcmt, deliverCnt);
} else if (ackType == UNDELIVERABLE_REQUEST) {
cleanList = handleUndeliverableMsgs(con, ids, cids);
} else {
if (tid != null) {
cleanList= handleTransaction(con, tid, ids, cids);
} else {
cleanList = handleAcks(con, ids, cids, msg.getSendAcknowledge());
}
}
}
} catch (Throwable thr) {
status = Status.ERROR;
if (thr instanceof BrokerException) {
status = ((BrokerException)thr).getStatusCode();
remoteStatus = ((BrokerException)thr).isRemote();
if (remoteStatus && ids != null && cids != null) {
remoteConsumerUIDs = new StringBuffer();
remoteConsumerUIDs.append(((BrokerException)thr).getRemoteConsumerUIDs());
remoteConsumerUIDs.append(" ");
String cidstr = null;
ArrayList remoteConsumerUIDa = new ArrayList();
for (int i = 0; i < ids.length; i++) {
PacketReference ref = Destination.get(ids[i]);
Consumer c = Consumer.getConsumer(cids[i]);
if (c == null) continue;
ConsumerUID sid = c.getStoredConsumerUID();
if (sid == null || sid.equals(cids[i])) {
continue;
}
BrokerAddress ba = (ref == null ? null: ref.getAddress());
BrokerAddress rba = ((BrokerException)thr).getRemoteBrokerAddress();
if (c != null && ref != null &&