activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r687287 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq: AMQPersistenceAdapter.java AMQPersistenceAdapterFactory.java
Date Wed, 20 Aug 2008 08:37:29 GMT
Author: rajdavies
Date: Wed Aug 20 01:37:28 2008
New Revision: 687287

URL: http://svn.apache.org/viewvc?rev=687287&view=rev
Log:
fix for https://issues.apache.org/activemq/browse/AMQ-1901

Modified:
    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/amq/AMQPersistenceAdapterFactory.java

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?rev=687287&r1=687286&r2=687287&view=diff
==============================================================================
--- 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
Wed Aug 20 01:37:28 2008
@@ -130,6 +130,8 @@
 	private boolean failIfJournalIsLocked;
     private boolean lockLogged;
     private boolean lockAquired;
+    private boolean recoverReferenceStore=true;
+    private boolean forceRecoverReferenceStore=false;
 
     public String getBrokerName() {
         return this.brokerName;
@@ -247,15 +249,19 @@
         // store, but they still
         // need to be recovered when the broker starts up.
 
-        if (!referenceStoreAdapter.isStoreValid()) {
+        if (isForceRecoverReferenceStore()
+                || (isRecoverReferenceStore() && !referenceStoreAdapter
+                        .isStoreValid())) {
             LOG.warn("The ReferenceStore is not valid - recovering ...");
             recover();
             LOG.info("Finished recovering the ReferenceStore");
         } else {
-            Location location = writeTraceMessage("RECOVERED " + new Date(), true);
+            Location location = writeTraceMessage("RECOVERED " + new Date(),
+                    true);
             asyncDataManager.setMark(location, true);
             // recover transactions
-            getTransactionStore().setPreparedTransactions(referenceStoreAdapter.retrievePreparedState());
+            getTransactionStore().setPreparedTransactions(
+                    referenceStoreAdapter.retrievePreparedState());
         }
 
         // Do a checkpoint periodically.
@@ -930,6 +936,34 @@
     public void setDisableLocking(boolean disableLocking) {
         this.disableLocking = disableLocking;
     }
+    
+    /**
+     * @return the recoverReferenceStore
+     */
+    public boolean isRecoverReferenceStore() {
+        return recoverReferenceStore;
+    }
+
+    /**
+     * @param recoverReferenceStore the recoverReferenceStore to set
+     */
+    public void setRecoverReferenceStore(boolean recoverReferenceStore) {
+        this.recoverReferenceStore = recoverReferenceStore;
+    }
+
+    /**
+     * @return the forceRecoverReferenceStore
+     */
+    public boolean isForceRecoverReferenceStore() {
+        return forceRecoverReferenceStore;
+    }
+
+    /**
+     * @param forceRecoverReferenceStore the forceRecoverReferenceStore to set
+     */
+    public void setForceRecoverReferenceStore(boolean forceRecoverReferenceStore) {
+        this.forceRecoverReferenceStore = forceRecoverReferenceStore;
+    }
 
 	
 	protected void addInProgressDataFile(AMQMessageStore store,int dataFileId) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapterFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapterFactory.java?rev=687287&r1=687286&r2=687287&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapterFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapterFactory.java
Wed Aug 20 01:37:28 2008
@@ -52,6 +52,9 @@
     private int indexMaxBinSize = HashIndex.MAXIMUM_CAPACITY;
     private int indexLoadFactor = HashIndex.DEFAULT_LOAD_FACTOR;
     private int maxReferenceFileLength=DEFAULT_MAX_REFERNCE_FILE_LENGTH;
+    private boolean recoverReferenceStore=true;
+    private boolean forceRecoverReferenceStore=false;
+    private long checkpointInterval = 1000 * 20;
 
 
     /**
@@ -75,6 +78,8 @@
         result.setIndexMaxBinSize(getIndexMaxBinSize());
         result.setIndexLoadFactor(getIndexLoadFactor());
         result.setMaxReferenceFileLength(getMaxReferenceFileLength());
+        result.setForceRecoverReferenceStore(isForceRecoverReferenceStore());
+        result.setRecoverReferenceStore(isRecoverReferenceStore());
         return result;
     }
 
@@ -286,4 +291,46 @@
     public void setMaxReferenceFileLength(int maxReferenceFileLength) {
         this.maxReferenceFileLength = maxReferenceFileLength;
     }
+
+    /**
+     * @return the recoverReferenceStore
+     */
+    public boolean isRecoverReferenceStore() {
+        return recoverReferenceStore;
+    }
+
+    /**
+     * @param recoverReferenceStore the recoverReferenceStore to set
+     */
+    public void setRecoverReferenceStore(boolean recoverReferenceStore) {
+        this.recoverReferenceStore = recoverReferenceStore;
+    }
+
+    /**
+     * @return the forceRecoverReferenceStore
+     */
+    public boolean isForceRecoverReferenceStore() {
+        return forceRecoverReferenceStore;
+    }
+
+    /**
+     * @param forceRecoverReferenceStore the forceRecoverReferenceStore to set
+     */
+    public void setForceRecoverReferenceStore(boolean forceRecoverReferenceStore) {
+        this.forceRecoverReferenceStore = forceRecoverReferenceStore;
+    }
+
+    /**
+     * @return the checkpointInterval
+     */
+    public long getCheckpointInterval() {
+        return checkpointInterval;
+    }
+
+    /**
+     * @param checkpointInterval the checkpointInterval to set
+     */
+    public void setCheckpointInterval(long checkpointInterval) {
+        this.checkpointInterval = checkpointInterval;
+    }
 }



Mime
View raw message