mirror of https://github.com/apache/activemq.git
it's ensure dispatching happens in order
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@490111 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d8674a0fed
commit
c651ace525
|
@ -22,6 +22,7 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import javax.jms.InvalidSelectorException;
|
||||
import javax.jms.JMSException;
|
||||
import org.apache.activemq.broker.Broker;
|
||||
|
@ -60,6 +61,7 @@ abstract public class PrefetchSubscription extends AbstractSubscription{
|
|||
protected long enqueueCounter;
|
||||
protected long dispatchCounter;
|
||||
protected long dequeueCounter;
|
||||
private AtomicBoolean dispatching = new AtomicBoolean();
|
||||
|
||||
public PrefetchSubscription(Broker broker,ConnectionContext context,ConsumerInfo info, PendingMessageCursor cursor)
|
||||
throws InvalidSelectorException{
|
||||
|
@ -389,6 +391,8 @@ abstract public class PrefetchSubscription extends AbstractSubscription{
|
|||
|
||||
|
||||
protected void dispatchMatched() throws IOException{
|
||||
if(dispatching.compareAndSet(false,true)){
|
||||
try{
|
||||
List toDispatch=null;
|
||||
synchronized(pending){
|
||||
try{
|
||||
|
@ -416,6 +420,10 @@ abstract public class PrefetchSubscription extends AbstractSubscription{
|
|||
dispatch(node);
|
||||
}
|
||||
}
|
||||
}finally{
|
||||
dispatching.set(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean dispatch(final MessageReference node) throws IOException{
|
||||
|
|
Loading…
Reference in New Issue