Author: chirino
Date: Thu May 29 12:23:18 2008
New Revision: 661439

URL: http://svn.apache.org/viewvc?rev=661439&view=rev
Log:
Fix the failing QueueMasterSlaveTestUsingSharedFileTest test.. due to chang in 
startup order of the persistence adapter.


Modified:
    
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/amq/AMQPersistenceAdapter.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=661439&r1=661438&r2=661439&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
 Thu May 29 12:23:18 2008
@@ -128,6 +128,8 @@
     private FileLock lock;
     private boolean disableLocking = DISABLE_LOCKING;
        private boolean failIfJournalIsLocked;
+    private boolean lockLogged;
+    private boolean lockAquired;
 
     public String getBrokerName() {
         return this.brokerName;
@@ -271,6 +273,14 @@
             }
         };
         Scheduler.executePeriodically(periodicCleanupTask, cleanupInterval);
+        
+        if (lockAquired && lockLogged) {
+            LOG.info("Aquired lock for AMQ Store" + getDirectory());
+            if (brokerService != null) {
+                brokerService.getBroker().nowMasterBroker();
+            }
+        }
+
     }
 
     public void stop() throws Exception {
@@ -923,27 +933,20 @@
        
        
        protected void lock() throws Exception {
-        boolean logged = false;
-        boolean aquiredLock = false;
+        lockLogged = false;
+        lockAquired = false;
         do {
             if (doLock()) {
-                aquiredLock = true;
+                lockAquired = true;
             } else {
-                if (!logged) {
+                if (!lockLogged) {
                     LOG.warn("Waiting to Lock the Store " + getDirectory());
-                    logged = true;
+                    lockLogged = true;
                 }
                 Thread.sleep(1000);
             }
 
-            if (aquiredLock && logged) {
-                LOG.info("Aquired lock for AMQ Store" + getDirectory());
-                if (brokerService != null) {
-                    brokerService.getBroker().nowMasterBroker();
-                }
-            }
-
-        } while (!aquiredLock && !disableLocking);
+        } while (!lockAquired && !disableLocking);
     }
        
        private synchronized void unlock() throws IOException {


Reply via email to