activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r955179 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb: KahaDBPersistenceAdapter.java MessageDatabase.java
Date Wed, 16 Jun 2010 10:17:06 GMT
Author: rajdavies
Date: Wed Jun 16 10:17:06 2010
New Revision: 955179

URL: http://svn.apache.org/viewvc?rev=955179&view=rev
Log:
Fix for https://issues.apache.org/activemq/browse/AMQ-2738

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java?rev=955179&r1=955178&r2=955179&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java
Wed Jun 16 10:17:06 2010
@@ -455,6 +455,20 @@ public class KahaDBPersistenceAdapter im
     public void setMaxAsyncJobs(int maxAsyncJobs) {
         letter.setMaxAsyncJobs(maxAsyncJobs);
     }
+    
+    /**
+     * @return the databaseLockedWaitDelay
+     */
+    public int getDatabaseLockedWaitDelay() {
+        return letter.getDatabaseLockedWaitDelay();
+    }
+
+    /**
+     * @param databaseLockedWaitDelay the databaseLockedWaitDelay to set
+     */
+    public void setDatabaseLockedWaitDelay(int databaseLockedWaitDelay) {
+       letter.setDatabaseLockedWaitDelay(databaseLockedWaitDelay);
+    }
 
     @Override
     public String toString() {

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=955179&r1=955178&r2=955179&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 Jun 16 10:17:06 2010
@@ -88,7 +88,7 @@ public class MessageDatabase extends Ser
     public static final int LOG_SLOW_ACCESS_TIME = Integer.parseInt(System.getProperty(PROPERTY_LOG_SLOW_ACCESS_TIME,
"500"));
 
     private static final Log LOG = LogFactory.getLog(MessageDatabase.class);
-    private static final int DATABASE_LOCKED_WAIT_DELAY = 10 * 1000;
+    private static final int DEFAULT_DATABASE_LOCKED_WAIT_DELAY = 10 * 1000;
 
     public static final int CLOSED_STATE = 1;
     public static final int OPEN_STATE = 2;
@@ -177,6 +177,7 @@ public class MessageDatabase extends Ser
     private int indexCacheSize = 10000;
     private boolean checkForCorruptJournalFiles = false;
     private boolean checksumJournalFiles = false;
+    private int databaseLockedWaitDelay = DEFAULT_DATABASE_LOCKED_WAIT_DELAY;
     
 
     public MessageDatabase() {
@@ -294,9 +295,9 @@ public class MessageDatabase extends Ser
                         lockFile.lock();
                         break;
                     } catch (IOException e) {
-                        LOG.info("Database "+lockFileName+" is locked... waiting " + (DATABASE_LOCKED_WAIT_DELAY
/ 1000) + " seconds for the database to be unlocked. Reason: " + e);
+                        LOG.info("Database "+lockFileName+" is locked... waiting " + (getDatabaseLockedWaitDelay()
/ 1000) + " seconds for the database to be unlocked. Reason: " + e);
                         try {
-                            Thread.sleep(DATABASE_LOCKED_WAIT_DELAY);
+                            Thread.sleep(getDatabaseLockedWaitDelay());
                         } catch (InterruptedException e1) {
                         }
                     }
@@ -1616,4 +1617,18 @@ public class MessageDatabase extends Ser
     public void setDirectoryArchive(File directoryArchive) {
         this.directoryArchive = directoryArchive;
     }
+
+    /**
+     * @return the databaseLockedWaitDelay
+     */
+    public int getDatabaseLockedWaitDelay() {
+        return this.databaseLockedWaitDelay;
+    }
+
+    /**
+     * @param databaseLockedWaitDelay the databaseLockedWaitDelay to set
+     */
+    public void setDatabaseLockedWaitDelay(int databaseLockedWaitDelay) {
+        this.databaseLockedWaitDelay = databaseLockedWaitDelay;
+    }
 }



Mime
View raw message