https://issues.apache.org/activemq/browse/AMQ-2985 - fix npe on remove consumer track new consumer last ack at lowest priority such that there can be no replay

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1038643 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2010-11-24 15:15:39 +00:00
parent d6ad7c7cd0
commit aec047d08b
2 changed files with 6 additions and 2 deletions

View File

@ -784,6 +784,10 @@ public class KahaDBStore extends MessageDatabase implements PersistenceAdapter {
MessageOrderCursor moc = sd.subscriptionCursors.get(subscriptionKey); MessageOrderCursor moc = sd.subscriptionCursors.get(subscriptionKey);
if (moc == null) { if (moc == null) {
LastAck pos = sd.subscriptionAcks.get(tx, subscriptionKey); LastAck pos = sd.subscriptionAcks.get(tx, subscriptionKey);
if (pos == null) {
// sub deleted
return;
}
sd.orderIndex.setBatch(tx, pos); sd.orderIndex.setBatch(tx, pos);
moc = sd.orderIndex.cursor; moc = sd.orderIndex.cursor;
} else { } else {

View File

@ -1314,7 +1314,7 @@ public class MessageDatabase extends ServiceSupport implements BrokerServiceAwar
public LastAck(long ackLocation) { public LastAck(long ackLocation) {
this.lastAckedSequence = ackLocation; this.lastAckedSequence = ackLocation;
this.priority = MessageOrderIndex.HI; this.priority = MessageOrderIndex.LO;
} }
public LastAck(long ackLocation, byte priority) { public LastAck(long ackLocation, byte priority) {
@ -2207,7 +2207,7 @@ public class MessageDatabase extends ServiceSupport implements BrokerServiceAwar
result = lowPriorityIndex.get(tx, key); result = lowPriorityIndex.get(tx, key);
lastGetPriority = LO; lastGetPriority = LO;
} else { } else {
lastGetPriority = HI; lastGetPriority = HI;
} }
} else { } else {
lastGetPriority = DEF; lastGetPriority = DEF;