activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r692539 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/ft/ main/java/org/apache/activemq/broker/region/ test/java/org/apache/activemq/advisory/
Date Fri, 05 Sep 2008 20:40:14 GMT
Author: gtully
Date: Fri Sep  5 13:40:14 2008
New Revision: 692539

URL: http://svn.apache.org/viewvc?rev=692539&view=rev
Log:
fix for AMQ-1849 with test, also master slave pendingdispatch messages were being ignored,
test shows this

Added:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/MasterSlaveTempQueueMemoryTest.java
  (with props)
Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java?rev=692539&r1=692538&r2=692539&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java
Fri Sep  5 13:40:14 2008
@@ -28,6 +28,7 @@
 import org.apache.activemq.command.ConnectionControl;
 import org.apache.activemq.command.ConnectionInfo;
 import org.apache.activemq.command.ConsumerInfo;
+import org.apache.activemq.command.DestinationInfo;
 import org.apache.activemq.command.ExceptionResponse;
 import org.apache.activemq.command.Message;
 import org.apache.activemq.command.MessageAck;
@@ -176,7 +177,7 @@
     /**
      * Removes a producer.
      * 
-     * @param context the enviorment the operation is being executed under.
+     * @param context the environment the operation is being executed under.
      * @param info
      * @throws Exception
      */
@@ -190,7 +191,7 @@
      * 
      * @param context
      * @param info
-     * @return the assocated subscription
+     * @return the associated subscription
      * @throws Exception
      */
     public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws
Exception {
@@ -211,6 +212,13 @@
         sendAsyncToSlave(info);
     }
 
+    public void removeDestinationInfo(ConnectionContext context, DestinationInfo info) throws
Exception {
+        super.removeDestinationInfo(context, info);
+        if (info.getDestination().isTemporary()) {
+            sendAsyncToSlave(info);
+        }
+
+    }
     /**
      * begin a transaction
      * 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java?rev=692539&r1=692538&r2=692539&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java
Fri Sep  5 13:40:14 2008
@@ -429,7 +429,7 @@
      * @return
      */
     public boolean isFull() {
-        return isSlave() || dispatched.size() - prefetchExtension >= info.getPrefetchSize();
+        return dispatched.size() - prefetchExtension >= info.getPrefetchSize();
     }
 
     /**

Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/MasterSlaveTempQueueMemoryTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/MasterSlaveTempQueueMemoryTest.java?rev=692539&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/MasterSlaveTempQueueMemoryTest.java
(added)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/MasterSlaveTempQueueMemoryTest.java
Fri Sep  5 13:40:14 2008
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.advisory;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.region.RegionBroker;
+
+public class MasterSlaveTempQueueMemoryTest extends TempQueueMemoryTest {
+    String masterBindAddress = "tcp://localhost:61616";
+    String slaveBindAddress = "tcp://localhost:62616";
+    BrokerService slave;
+    
+    /*
+     * add a slave broker
+     * @see org.apache.activemq.EmbeddedBrokerTestSupport#createBroker()
+     */
+    @Override
+    protected BrokerService createBroker() throws Exception {
+        // bindAddress is used by super.createBroker
+        bindAddress = masterBindAddress;
+        BrokerService master = super.createBroker();
+        master.setBrokerName("master");
+        bindAddress = slaveBindAddress;
+        slave = super.createBroker();
+        slave.setBrokerName("slave");
+        slave.setMasterConnectorURI(masterBindAddress);
+        bindAddress = masterBindAddress;
+        return master;
+    }
+
+    @Override
+    protected void startBroker() throws Exception {
+        super.startBroker();
+        slave.start();
+    }
+
+    @Override
+    public void testLoadRequestReply() throws Exception {
+        super.testLoadRequestReply();
+        
+        // some checks on the slave
+        AdvisoryBroker ab = (AdvisoryBroker) slave.getBroker().getAdaptor(
+                AdvisoryBroker.class);
+        
+        assertEquals("the temp queues should not be visible as they are removed", 1, ab.getAdvisoryDestinations().size());
+                       
+        RegionBroker rb = (RegionBroker) slave.getBroker().getAdaptor(
+                RegionBroker.class); 
+               
+        //serverDestination + 
+        assertEquals(6, rb.getDestinationMap().size());          
+    }
+    
+}

Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/MasterSlaveTempQueueMemoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/MasterSlaveTempQueueMemoryTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message