activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r783364 - in /activemq/trunk: activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java kahadb/src/main/java/org/apache/kahadb/util/LockFile.java
Date Wed, 10 Jun 2009 14:06:59 GMT
Author: gtully
Date: Wed Jun 10 14:06:59 2009
New Revision: 783364

URL: http://svn.apache.org/viewvc?rev=783364&view=rev
Log:
fix file lock usage in kahadb store, so shared file system master slave can work

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

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=783364&r1=783363&r2=783364&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 10 14:06:59 2009
@@ -229,7 +229,7 @@
 	                    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.");
+	                    LOG.info("Database "+lockFileName+" is locked... waiting " + (DATABASE_LOCKED_WAIT_DELAY
/ 1000) + " seconds for the database to be unlocked. Reason: " + e);
 	                    try {
 	                        Thread.sleep(DATABASE_LOCKED_WAIT_DELAY);
 	                    } catch (InterruptedException e1) {

Modified: activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java
URL: http://svn.apache.org/viewvc/activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java?rev=783364&r1=783363&r2=783364&view=diff
==============================================================================
--- activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java (original)
+++ activemq/trunk/kahadb/src/main/java/org/apache/kahadb/util/LockFile.java Wed Jun 10 14:06:59
2009
@@ -50,8 +50,7 @@
             return;
         }
 
-        lockCounter++;
-        if( lockCounter!=1 ) {
+        if( lockCounter>0 ) {
             return;
         }
         
@@ -63,9 +62,12 @@
             } catch (OverlappingFileLockException e) {
                 throw IOExceptionSupport.create("File '" + file + "' could not be locked.",e);
             }
-            if (lock == null) {
+            if (lock != null) {
+                lockCounter++;
+            } else {
                 throw new IOException("File '" + file + "' could not be locked.");
             }
+              
         }
     }
 



Mime
View raw message