use of com.sun.messaging.jmq.jmsserver.util.lists.RemoveReason in project openmq by eclipse-ee4j.
the class AckHandler method handleDeadMsgs.
public void handleDeadMsgs(IMQConnection con, SysMessageID[] ids, ConsumerUID[] cids, int deadrs, Throwable thr, String comment, int deliverCnt, List cleanList) throws BrokerException {
RemoveReason deadReason = RemoveReason.UNDELIVERABLE;
if (deadrs == DEAD_REASON_EXPIRED) {
deadReason = RemoveReason.EXPIRED_BY_CLIENT;
}
for (int i = 0; i < ids.length; i++) {
Session s = Session.getSession(cids[i]);
if (s == null) {
// consumer does not have session
// really nothing to do, ignore
logger.log(Logger.DEBUG, "Dead message for Unknown Consumer/Session" + cids[i]);
continue;
}
if (DEBUG) {
logger.log(logger.INFO, "handleDead[" + i + ", " + ids.length + "]:sysid=" + ids[i] + ", cid=" + cids[i] + ", on connection " + con);
}
PacketReference ref = (PacketReference) s.handleDead(cids[i], ids[i], deadReason, thr, comment, deliverCnt);
// no consumers .. so clean it up
if (ref != null) {
cleanList.add(ref);
}
}
}
use of com.sun.messaging.jmq.jmsserver.util.lists.RemoveReason in project openmq by eclipse-ee4j.
the class BrokerConsumers method removeRemoteDeadMessage.
private boolean removeRemoteDeadMessage(int ackType, PacketReference ref, ConsumerUID cuid, ConsumerUID storedid, Map optionalProps) throws BrokerException {
if (ref == null) {
return true;
}
Destination d = ref.getDestination();
Queue[] qs = DL.getDMQ(ref.getPartitionedStore());
if (d == qs[0]) {
// already gone, ignore
return true;
}
// first pull out properties
String comment = null;
Exception ex = null;
Integer deliverCnt = null;
Integer reasonInt = null;
String deadbkr = null;
if (optionalProps != null) {
comment = (String) optionalProps.get(DMQ.UNDELIVERED_COMMENT);
ex = (Exception) optionalProps.get(DMQ.UNDELIVERED_EXCEPTION);
deliverCnt = (Integer) optionalProps.get(Destination.TEMP_CNT);
reasonInt = (Integer) optionalProps.get("REASON");
deadbkr = (String) optionalProps.get(DMQ.DEAD_BROKER);
}
RemoveReason rr = null;
if (ackType == ClusterBroadcast.MSG_UNDELIVERABLE) {
rr = RemoveReason.UNDELIVERABLE;
} else {
rr = RemoveReason.ERROR;
if (reasonInt != null) {
rr = RemoveReason.findReason(reasonInt.intValue());
}
}
if (comment == null) {
comment = "none";
}
if (ref.markDead(cuid, storedid, comment, ex, rr, (deliverCnt == null ? 0 : deliverCnt.intValue()), deadbkr)) {
try {
if (ref.isDead()) {
if (getDEBUG()) {
Globals.getLogger().log(logger.INFO, "Remove dead message " + ref + " for remote consumer " + cuid + " on destination " + d + " with reason " + rr);
}
try {
d.removeDeadMessage(ref);
} catch (Exception e) {
logger.log(logger.WARNING, "Unable to remove dead[" + rr + ", " + deadbkr + "] message " + ref + "[" + cuid + "]: " + e.getMessage(), e);
}
}
} finally {
ref.postAcknowledgedRemoval();
}
return true;
}
return false;
}
Aggregations