activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r516408 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store: ReferenceStoreAdapter.java amq/AMQPersistenceAdapter.java kahadaptor/TopicSubContainer.java
Date Fri, 09 Mar 2007 13:30:34 GMT
Author: rajdavies
Date: Fri Mar  9 05:30:33 2007
New Revision: 516408

URL: http://svn.apache.org/viewvc?view=rev&rev=516408
Log:
added isStoreValid() method - used by AMQStore to determine if references need to be rebuilt

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/ReferenceStoreAdapter.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/TopicSubContainer.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/ReferenceStoreAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/ReferenceStoreAdapter.java?view=diff&rev=516408&r1=516407&r2=516408
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/ReferenceStoreAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/ReferenceStoreAdapter.java
Fri Mar  9 05:30:33 2007
@@ -41,5 +41,11 @@
     public TopicReferenceStore createTopicReferenceStore(ActiveMQTopic destination) throws
IOException;
 
 	public Set<Integer> getReferenceFileIdsInUse() throws IOException;
+    
+    /**
+     * If the store isn't valid, it can be recoverd at start-up
+     * @return true if the reference store is in a consistent state
+     */
+    public boolean isStoreValid();
 
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java?view=diff&rev=516408&r1=516407&r2=516408
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.java
Fri Mar  9 05:30:33 2007
@@ -157,7 +157,14 @@
             }
         },"ActiveMQ Journal Checkpoint Worker");
         createTransactionStore();
-        recover();
+        if(referenceStoreAdapter.isStoreValid()==false){
+            log.warn("The ReferenceStore is not valid - recovering ...");
+            recover();
+            log.info("Finished recovering the ReferenceStore");
+        }else {
+            Location location=writeTraceMessage("RECOVERED "+new Date(),true);
+            asyncDataManager.setMark(location,true);
+        }
         // Do a checkpoint periodically.
         periodicCheckpointTask=new Runnable(){
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/TopicSubContainer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/TopicSubContainer.java?view=diff&rev=516408&r1=516407&r2=516408
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/TopicSubContainer.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadaptor/TopicSubContainer.java
Fri Mar  9 05:30:33 2007
@@ -58,18 +58,21 @@
         return listContainer.placeLast(ref);
     }
 
-    public ConsumerMessageRef remove(MessageId id) {
-        ConsumerMessageRef result = null;
-        if (!listContainer.isEmpty()) {
-            for (StoreEntry entry = listContainer.getFirst(); entry != null; entry = listContainer.getNext(entry))
{
-                ConsumerMessageRef ref = (ConsumerMessageRef) listContainer.get(entry);
-                if (ref != null && ref.getMessageId().equals(id)) {
-                    listContainer.remove(entry);
-                    result = ref;
-                    if (listContainer != null && batchEntry != null && (listContainer.isEmpty()
|| batchEntry.equals(entry))) {
+    public ConsumerMessageRef remove(MessageId id){
+        ConsumerMessageRef result=null;
+        if(!listContainer.isEmpty()){
+            StoreEntry entry=listContainer.getFirst();
+            while(entry!=null){
+                ConsumerMessageRef ref=(ConsumerMessageRef)listContainer.get(entry);
+                listContainer.remove(entry);
+                if(ref!=null&&ref.getMessageId().equals(id)){
+                    result=ref;
+                    if(listContainer!=null&&batchEntry!=null&&(listContainer.isEmpty()||batchEntry.equals(entry))){
                         reset();
                     }
+                    break;
                 }
+                entry=listContainer.getFirst();
             }
         }
         return result;



Mime
View raw message