You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2006/12/31 16:35:38 UTC

svn commit: r491431 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java

Author: rajdavies
Date: Sun Dec 31 07:35:38 2006
New Revision: 491431

URL: http://svn.apache.org/viewvc?view=rev&rev=491431
Log:
check we are not a slaveBroker() when dispatching

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java?view=diff&rev=491431&r1=491430&r2=491431
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java (original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java Sun Dec 31 07:35:38 2006
@@ -125,18 +125,19 @@
         
     public void add(MessageReference node) throws Exception{
         boolean pendingEmpty=false;
+        
         synchronized(pending){
             pendingEmpty=pending.isEmpty();
             enqueueCounter++;
         }
-        if(!isFull()&&pendingEmpty){
+        if(!isFull()&&pendingEmpty&&!broker.isSlaveBroker()){
             dispatch(node);
         }else{
             optimizePrefetch();
             synchronized(pending){
                 if(pending.isEmpty()&&log.isDebugEnabled()){
                     log.debug("Prefetch limit.");
-                }
+                }       
                 pending.addMessageLast(node);
             }
             //we might be able to dispatch messages (i.e. not full() anymore)
@@ -155,6 +156,7 @@
                         pending.remove();
                         createMessageDispatch(node,node.getMessage());
                         dispatched.addLast(node);
+                        
                         return;
                     }
                 }
@@ -162,7 +164,7 @@
                 pending.release();
             }
             throw new JMSException("Slave broker out of sync with master: Dispatched message ("+mdn.getMessageId()
-                    +") was not in the pending list: "+pending);
+                    +") was not in the pending list");
         }
     }
 
@@ -395,7 +397,7 @@
 
 
     protected void dispatchMatched() throws IOException{
-        if(dispatching.compareAndSet(false,true)){
+        if(!broker.isSlaveBroker() && dispatching.compareAndSet(false,true)){
             try{
                 List toDispatch=null;
                 synchronized(pending){