activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r946974 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/ft/MasterBroker.java test/java/org/apache/activemq/broker/ft/MasterSlaveProducerFlowControlTest.java
Date Fri, 21 May 2010 11:40:28 GMT
Author: gtully
Date: Fri May 21 11:40:27 2010
New Revision: 946974

URL: http://svn.apache.org/viewvc?rev=946974&view=rev
Log:
possibly resolve https://issues.apache.org/activemq/browse/AMQ-2564 - add test and fix issue
with slave replication effecting response correlator when message is queued waiting for space,
the id can get out of sync, causing a missed reply to the orignal producer, which would result
in a hang

Added:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/MasterSlaveProducerFlowControlTest.java
  (with props)
Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.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=946974&r1=946973&r2=946974&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 May 21 11:40:27 2010
@@ -341,8 +341,9 @@ public class MasterBroker extends Insert
          * A message can be dispatched before the super.send() method returns so -
          * here the order is switched to avoid problems on the slave with
          * receiving acks for messages not received yet
+         * copy ensures we don't mess with the correlator and command ids
          */
-        sendSyncToSlave(message);
+        sendSyncToSlave(message.copy());
         super.send(producerExchange, message);
     }
 

Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/MasterSlaveProducerFlowControlTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/MasterSlaveProducerFlowControlTest.java?rev=946974&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/MasterSlaveProducerFlowControlTest.java
(added)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/MasterSlaveProducerFlowControlTest.java
Fri May 21 11:40:27 2010
@@ -0,0 +1,57 @@
+/**
+ * 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.broker.ft;
+
+import org.apache.activemq.ProducerFlowControlTest;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.region.policy.PolicyEntry;
+import org.apache.activemq.broker.region.policy.PolicyMap;
+import org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy;
+import org.apache.activemq.broker.region.policy.VMPendingSubscriberMessageStoragePolicy;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class MasterSlaveProducerFlowControlTest extends ProducerFlowControlTest {
+    static final Log LOG = LogFactory.getLog(MasterSlaveProducerFlowControlTest.class);
+
+    protected BrokerService createBroker() throws Exception {
+        BrokerService service = super.createBroker();
+        service.start();
+        
+        BrokerService slave = new BrokerService();
+        slave.setBrokerName("Slave");
+        slave.setPersistent(false);
+        slave.setUseJmx(false);
+        
+        // Setup a destination policy where it takes lots of message at a time.
+        // so that slave does not block first as there is no producer flow control
+        // on the master connector
+        PolicyMap policyMap = new PolicyMap();
+        PolicyEntry policy = new PolicyEntry();
+        // don't apply the same memory limit as the master in this case
+        //policy.setMemoryLimit(10);
+        policy.setPendingSubscriberPolicy(new VMPendingSubscriberMessageStoragePolicy());
+        policy.setPendingQueuePolicy(new VMPendingQueueMessageStoragePolicy());
+        policy.setProducerFlowControl(true);
+        policyMap.setDefaultEntry(policy);
+        
+        slave.setDestinationPolicy(policyMap);
+        slave.setMasterConnectorURI(connector.getConnectUri().toString());
+        slave.start();
+        return service;
+    }
+}

Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/MasterSlaveProducerFlowControlTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/ft/MasterSlaveProducerFlowControlTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message