mirror of https://github.com/apache/activemq.git
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@382439 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d8c086274a
commit
acce91b74e
|
@ -107,24 +107,8 @@ abstract public class PrefetchSubscription extends AbstractSubscription{
|
||||||
context.getTransaction().addSynchronization(new Synchronization(){
|
context.getTransaction().addSynchronization(new Synchronization(){
|
||||||
public void afterCommit() throws Throwable{
|
public void afterCommit() throws Throwable{
|
||||||
synchronized(PrefetchSubscription.this){
|
synchronized(PrefetchSubscription.this){
|
||||||
// Now that we are committed, we can remove the nodes.
|
dispatched.remove(node);
|
||||||
boolean inAckRange=false;
|
delivered--;
|
||||||
int index=0;
|
|
||||||
for(Iterator iter=dispatched.iterator();iter.hasNext();){
|
|
||||||
final MessageReference node=(MessageReference) iter.next();
|
|
||||||
MessageId messageId=node.getMessageId();
|
|
||||||
if(ack.getFirstMessageId()==null||ack.getFirstMessageId().equals(messageId)){
|
|
||||||
inAckRange=true;
|
|
||||||
}
|
|
||||||
if(inAckRange){
|
|
||||||
index++;
|
|
||||||
iter.remove();
|
|
||||||
if(ack.getLastMessageId().equals(messageId)){
|
|
||||||
delivered=Math.max(0,delivered-(index+1));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue