You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2009/05/14 17:46:53 UTC

svn commit: r774829 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/region/ test/java/org/apache/activemq/broker/ test/java/org/apache/activemq/broker/region/

Author: gtully
Date: Thu May 14 15:46:52 2009
New Revision: 774829

URL: http://svn.apache.org/viewvc?rev=774829&view=rev
Log:
resolve https://issues.apache.org/activemq/browse/AMQ-2252 - deadlock with nio and optimizeDispatch and test case

Added:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/NioQueueSubscriptionTest.java   (with props)
Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java?rev=774829&r1=774828&r2=774829&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/Queue.java Thu May 14 15:46:52 2009
@@ -1156,7 +1156,6 @@
         if (!ack.isInTransaction()) {
             acknowledge(context, sub, ack, reference);
             dropMessage(reference);
-            wakeup();
         } else {
             try {
                 acknowledge(context, sub, ack, reference);

Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/NioQueueSubscriptionTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/NioQueueSubscriptionTest.java?rev=774829&view=auto
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/NioQueueSubscriptionTest.java (added)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/NioQueueSubscriptionTest.java Thu May 14 15:46:52 2009
@@ -0,0 +1,51 @@
+/**
+ * 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;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jms.ConnectionFactory;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.broker.region.policy.PolicyEntry;
+import org.apache.activemq.broker.region.policy.PolicyMap;
+
+
+public class NioQueueSubscriptionTest extends QueueSubscriptionTest {
+    
+    @Override
+    protected ConnectionFactory createConnectionFactory() throws Exception {
+        return new ActiveMQConnectionFactory("tcp://localhost:62621");
+    }
+    
+    @Override
+    protected BrokerService createBroker() throws Exception {
+        BrokerService answer = BrokerFactory.createBroker(new URI("broker://nio://localhost:62621?persistent=false&useJmx=true"));
+        final List<PolicyEntry> policyEntries = new ArrayList<PolicyEntry>();
+        final PolicyEntry entry = new PolicyEntry();
+        entry.setQueue(">");
+        entry.setOptimizedDispatch(true);
+        policyEntries.add(entry);
+
+        final PolicyMap policyMap = new PolicyMap();
+        policyMap.setPolicyEntries(policyEntries);
+        answer.setDestinationPolicy(policyMap);
+        return answer;
+    }
+}

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

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

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java?rev=774829&r1=774828&r2=774829&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java (original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java Thu May 14 15:46:52 2009
@@ -303,6 +303,7 @@
                         queue.removeMessage(contextNotInTx, subscription,
                                 new IndirectMessageReference(
                                         getMessage(removeIndex)), ack);
+                        queue.wakeup();
 
                     }
                     if (removeIndex % 1000 == 0) {