activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r982180 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/store/kahadb/ test/java/org/apache/activemq/broker/region/
Date Wed, 04 Aug 2010 09:41:55 GMT
Author: gtully
Date: Wed Aug  4 09:41:54 2010
New Revision: 982180

URL: http://svn.apache.org/viewvc?rev=982180&view=rev
Log:
resolve failure if DestinationRemoveRestartTest - destinations were auto created in the store
on resetbatch which ocurred on shutdown

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/DestinationRemoveRestartTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java?rev=982180&r1=982179&r2=982180&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java
Wed Aug  4 09:41:54 2010
@@ -520,8 +520,10 @@ public class KahaDBStore extends Message
             try {
                 pageFile.tx().execute(new Transaction.Closure<Exception>() {
                     public void execute(Transaction tx) throws Exception {
-                StoredDestination sd = getStoredDestination(dest, tx);
-                sd.orderIndex.resetCursorPosition();}
+                        StoredDestination sd = getExistingStoredDestination(dest, tx);
+                        if (sd != null) {
+                            sd.orderIndex.resetCursorPosition();}
+                        }
                     });
             } catch (Exception e) {
                 LOG.error("Failed to reset batching",e);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java?rev=982180&r1=982179&r2=982180&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
Wed Aug  4 09:41:54 2010
@@ -1392,6 +1392,16 @@ public class MessageDatabase extends Ser
         return rc;
     }
 
+
+    protected StoredDestination getExistingStoredDestination(KahaDestination destination,
Transaction tx) throws IOException {
+        String key = key(destination);
+        StoredDestination rc = storedDestinations.get(key);
+        if (rc == null && metadata.destinations.containsKey(tx, key)) {
+            rc = getStoredDestination(destination, tx);
+        }
+        return rc;
+    }
+
     /**
      * @param tx
      * @param key

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/DestinationRemoveRestartTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/DestinationRemoveRestartTest.java?rev=982180&r1=982179&r2=982180&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/DestinationRemoveRestartTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/region/DestinationRemoveRestartTest.java
Wed Aug  4 09:41:54 2010
@@ -24,7 +24,7 @@ import org.apache.activemq.command.Activ
 // from https://issues.apache.org/activemq/browse/AMQ-2216
 public class DestinationRemoveRestartTest extends CombinationTestSupport {
     private final static String destinationName = "TEST";
-    public byte destinationType;
+    public byte destinationType = ActiveMQDestination.QUEUE_TYPE;
     BrokerService broker;
 
     @Override
@@ -36,6 +36,7 @@ public class DestinationRemoveRestartTes
         BrokerService broker = new BrokerService();
         broker.setUseJmx(false);
         broker.setPersistent(true);
+        broker.setDeleteAllMessagesOnStartup(true);
         broker.start();
         return broker;
     }



Mime
View raw message