qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject svn commit: r1560400 - in /qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore: jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/ jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/jmx/ src/main/java/org/apache/qpid/server/store/ber...
Date Wed, 22 Jan 2014 16:08:19 GMT
Author: kwall
Date: Wed Jan 22 16:08:18 2014
New Revision: 1560400

URL: http://svn.apache.org/r1560400
Log:
QPID-5409: Refactring of bdb ha replication functionality and fixing tests

Added:
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/LoggingAsyncExceptionListener.java
      - copied, changed from r1560333, qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/NoopReplicationGroupListener.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java
      - copied, changed from r1560333, qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacade.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeFactory.java
      - copied, changed from r1560333, qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacadeFactory.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/NoopReplicationGroupListener.java
      - copied, changed from r1560333, qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/NoopReplicationGroupListener.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeTest.java
      - copied, changed from r1560333, qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacadeTest.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TestStateChangeListener.java
      - copied, changed from r1560333, qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/TestStateChangeListener.java
Removed:
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacade.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacadeFactory.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/NoopReplicationGroupListener.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacadeTest.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/TestStateChangeListener.java
Modified:
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBean.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanProvider.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanTest.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/EnvironmentFacade.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/EnvironmentFacadeFactory.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeFactory.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/DatabasePinger.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/LocalReplicationNode.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreQuotaEventsTest.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/MessageStoreCreatorTest.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeTest.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/VirtualHostTest.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/LocalReplicationNodeTest.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java
    qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBean.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBean.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBean.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBean.java Wed Jan 22 16:08:18 2014
@@ -39,7 +39,7 @@ import org.apache.log4j.Logger;
 import org.apache.qpid.AMQStoreException;
 import org.apache.qpid.server.jmx.AMQManagedObject;
 import org.apache.qpid.server.jmx.ManagedObject;
-import org.apache.qpid.server.store.berkeleydb.ReplicatedEnvironmentFacade;
+import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade;
 
 /**
  * Management mbean for BDB HA.

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanProvider.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanProvider.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanProvider.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/main/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanProvider.java Wed Jan 22 16:08:18 2014
@@ -29,7 +29,7 @@ import org.apache.qpid.server.jmx.Manage
 import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.store.berkeleydb.BDBMessageStore;
-import org.apache.qpid.server.store.berkeleydb.ReplicatedEnvironmentFacade;
+import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade;
 
 /**
  * This provide will create a {@link BDBHAMessageStoreManagerMBean} if the child is a virtual

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanTest.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanTest.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/jmx/src/test/java/org/apache/qpid/server/store/berkeleydb/jmx/BDBHAMessageStoreManagerMBeanTest.java Wed Jan 22 16:08:18 2014
@@ -43,9 +43,9 @@ import org.apache.qpid.server.jmx.Manage
 import org.apache.qpid.server.logging.SystemOutMessageLogger;
 import org.apache.qpid.server.logging.actors.CurrentActor;
 import org.apache.qpid.server.logging.actors.TestLogActor;
-import org.apache.qpid.server.store.berkeleydb.ReplicatedEnvironmentFacade;
 import org.apache.qpid.server.store.berkeleydb.jmx.BDBHAMessageStoreManagerMBean;
 import org.apache.qpid.server.store.berkeleydb.jmx.ManagedBDBHAMessageStore;
+import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade;
 
 public class BDBHAMessageStoreManagerMBeanTest extends TestCase
 {

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java Wed Jan 22 16:08:18 2014
@@ -22,7 +22,6 @@ package org.apache.qpid.server.store.ber
 
 import com.sleepycat.je.DatabaseException;
 import com.sleepycat.je.Environment;
-import com.sleepycat.je.EnvironmentConfig;
 import com.sleepycat.je.util.DbBackup;
 import org.apache.log4j.Logger;
 
@@ -336,17 +335,4 @@ public class BDBBackup
         return backedUpFileNames.toArray(new String[backedUpFileNames.size()]);
     }
 
-    /*
-     * Creates an environment for the bdb log files in the specified directory. This envrinonment can only be used
-     * to backup these files, if they are not locked by another database instance.
-     *
-     * @param fromdir The path to the directory to create the environment for.
-     *
-     * @throws DatabaseException Any underlying exceptions from BDB are allowed to fall through.
-     */
-    private Environment createSourceDirEnvironment(String fromdir) throws DatabaseException
-    {
-        // Initialize the BDB backup utility on the source directory.
-        return new Environment(new File(fromdir), new EnvironmentConfig());
-    }
 }

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java Wed Jan 22 16:08:18 2014
@@ -20,16 +20,9 @@ package org.apache.qpid.server.store.ber
  *
  */
 
-import java.util.concurrent.Callable;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-
 import org.apache.log4j.Logger;
 import org.apache.qpid.server.configuration.VirtualHostConfiguration;
 import org.apache.qpid.server.connection.IConnectionRegistry;
-import org.apache.qpid.server.logging.RootMessageLogger;
-import org.apache.qpid.server.logging.actors.AbstractActor;
-import org.apache.qpid.server.logging.actors.CurrentActor;
 import org.apache.qpid.server.logging.subjects.MessageStoreLogSubject;
 import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.replication.ReplicationGroupListener;
@@ -40,6 +33,8 @@ import org.apache.qpid.server.store.Even
 import org.apache.qpid.server.store.EventListener;
 import org.apache.qpid.server.store.MessageStore;
 import org.apache.qpid.server.store.OperationalLoggingListener;
+import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade;
+import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacadeFactory;
 import org.apache.qpid.server.virtualhost.AbstractVirtualHost;
 import org.apache.qpid.server.virtualhost.DefaultUpgraderProvider;
 import org.apache.qpid.server.virtualhost.State;
@@ -71,7 +66,7 @@ public class BDBHAVirtualHost extends Ab
 
     protected void initialiseStorage(VirtualHostConfiguration hostConfig, VirtualHost virtualHost) throws Exception
     {
-        _messageStore = new BDBMessageStore(ReplicatedEnvironmentFacade.TYPE, new ReplicatedEnvironmentFacadeFactory());
+        _messageStore = new BDBMessageStore(new ReplicatedEnvironmentFacadeFactory());
 
         final MessageStoreLogSubject storeLogSubject =
                 new MessageStoreLogSubject(getName(), _messageStore.getClass().getSimpleName());

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java Wed Jan 22 16:08:18 2014
@@ -83,7 +83,6 @@ public class BDBHAVirtualHostFactory imp
     {
         LinkedHashMap<String,Object> convertedMap = new LinkedHashMap<String, Object>();
         Configuration storeConfiguration = configuration.subset("store");
-        convertedMap.put(org.apache.qpid.server.model.VirtualHost.STORE_PATH, storeConfiguration.getString(MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY));
         convertedMap.put(MessageStoreConstants.OVERFULL_SIZE_ATTRIBUTE, storeConfiguration.getString(MessageStoreConstants.OVERFULL_SIZE_PROPERTY));
         convertedMap.put(MessageStoreConstants.UNDERFULL_SIZE_ATTRIBUTE, storeConfiguration.getString(MessageStoreConstants.UNDERFULL_SIZE_PROPERTY));
         return convertedMap;
@@ -119,6 +118,8 @@ public class BDBHAVirtualHostFactory imp
         attributes.put(ReplicationNode.GROUP_NAME, groupName);
         attributes.put(ReplicationNode.HOST_PORT, storeConfiguration.getString("highAvailability.nodeHostPort"));
         attributes.put(ReplicationNode.HELPER_HOST_PORT, storeConfiguration.getString("highAvailability.helperHostPort"));
+        attributes.put(org.apache.qpid.server.model.VirtualHost.STORE_PATH,
+                storeConfiguration.getString(MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY));
 
         String durability = storeConfiguration.getString("highAvailability.durability");
         if (durability != null)

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java Wed Jan 22 16:08:18 2014
@@ -25,6 +25,7 @@ import com.sleepycat.bind.tuple.IntegerB
 import com.sleepycat.bind.tuple.LongBinding;
 import com.sleepycat.je.*;
 import com.sleepycat.je.Transaction;
+
 import java.io.File;
 import java.lang.ref.SoftReference;
 import java.nio.ByteBuffer;
@@ -37,6 +38,7 @@ import java.util.Random;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicBoolean;
+
 import org.apache.log4j.Logger;
 import org.apache.qpid.AMQStoreException;
 import org.apache.qpid.server.message.EnqueableMessage;
@@ -71,7 +73,7 @@ public class BDBMessageStore implements 
     private static final Logger LOGGER = Logger.getLogger(BDBMessageStore.class);
 
     public static final int VERSION = 7;
-    public static final String TYPE = "BDB";
+    public static final String ENVIRONMENT_CONFIGURATION = "bdbEnvironmentConfig";
 
     private static final int LOCK_RETRY_ATTEMPTS = 5;
     private static String CONFIGURED_OBJECTS_DB_NAME = "CONFIGURED_OBJECTS";
@@ -104,7 +106,6 @@ public class BDBMessageStore implements 
     private long _persistentSizeHighThreshold;
 
     private final EventManager _eventManager = new EventManager();
-    private String _storeLocation;
     private final String _type;
     private VirtualHost _virtualHost;
 
@@ -114,12 +115,12 @@ public class BDBMessageStore implements 
 
     public BDBMessageStore()
     {
-        this(TYPE, new StandardEnvironmentFacadeFactory());
+        this(new StandardEnvironmentFacadeFactory());
     }
 
-    public BDBMessageStore(String type, EnvironmentFacadeFactory environmentFacadeFactory)
+    public BDBMessageStore(EnvironmentFacadeFactory environmentFacadeFactory)
     {
-        _type = type;
+        _type = environmentFacadeFactory.getType();;
         _environmentFacadeFactory = environmentFacadeFactory;
         _stateManager = new StateManager(_eventManager);
     }
@@ -218,27 +219,6 @@ public class BDBMessageStore implements 
 
     private void configure(VirtualHost virtualHost, boolean isMessageStore) throws AMQStoreException
     {
-        String name = virtualHost.getName();
-        final String defaultPath = System.getProperty("QPID_WORK") + File.separator + "bdbstore" + File.separator + name;
-
-        String storeLocation;
-        if(isMessageStore)
-        {
-            storeLocation = (String) virtualHost.getAttribute(VirtualHost.STORE_PATH);
-            if(storeLocation == null)
-            {
-                storeLocation = defaultPath;
-            }
-        }
-        else // we are acting only as the durable config store
-        {
-            storeLocation = (String) virtualHost.getAttribute(VirtualHost.CONFIG_STORE_PATH);
-            if(storeLocation == null)
-            {
-                storeLocation = defaultPath;
-            }
-        }
-
         Object overfullAttr = virtualHost.getAttribute(MessageStoreConstants.OVERFULL_SIZE_ATTRIBUTE);
         Object underfullAttr = virtualHost.getAttribute(MessageStoreConstants.UNDERFULL_SIZE_ATTRIBUTE);
 
@@ -253,29 +233,20 @@ public class BDBMessageStore implements 
             _persistentSizeLowThreshold = _persistentSizeHighThreshold;
         }
 
-        File environmentPath = new File(storeLocation);
-        if (!environmentPath.exists())
-        {
-            if (!environmentPath.mkdirs())
-            {
-                throw new IllegalArgumentException("Environment path " + environmentPath + " could not be read or created. "
-                                                   + "Ensure the path is correct and that the permissions are correct.");
-            }
-        }
-
-        _storeLocation = storeLocation;
-
-        LOGGER.info("Setting up environment");
-        _environmentFacade = _environmentFacadeFactory.createEnvironmentFacade(storeLocation, virtualHost);
+        _environmentFacade = _environmentFacadeFactory.createEnvironmentFacade(virtualHost, isMessageStore);
 
-        _committer = _environmentFacade.createCommitter(null);
+        _committer = _environmentFacade.createCommitter(virtualHost.getName());
         _committer.start();
     }
 
     @Override
     public String getStoreLocation()
     {
-        return _storeLocation;
+        if (_environmentFacade == null)
+        {
+            return null;
+        }
+        return _environmentFacade.getStoreLocation();
     }
 
     public EnvironmentFacade getEnvironmentFacade()
@@ -1695,19 +1666,21 @@ public class BDBMessageStore implements 
     @Override
     public void onDelete()
     {
-        if (LOGGER.isDebugEnabled())
-        {
-            LOGGER.debug("Deleting store " + _storeLocation);
-        }
+        String storeLocation = getStoreLocation();
 
-        if (_storeLocation != null)
+        if (storeLocation != null)
         {
-            File location = new File(_storeLocation);
+            if (LOGGER.isDebugEnabled())
+            {
+                LOGGER.debug("Deleting store " + storeLocation);
+            }
+
+            File location = new File(storeLocation);
             if (location.exists())
             {
                 if (!FileUtils.delete(location, true))
                 {
-                    LOGGER.error("Cannot delete " + _storeLocation);
+                    LOGGER.error("Cannot delete " + storeLocation);
                 }
             }
         }

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreFactory.java Wed Jan 22 16:08:18 2014
@@ -24,6 +24,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 import org.apache.commons.configuration.Configuration;
 import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.plugin.DurableConfigurationStoreFactory;
@@ -37,7 +38,7 @@ public class BDBMessageStoreFactory impl
     @Override
     public String getType()
     {
-        return BDBMessageStore.TYPE;
+        return StandardEnvironmentFacade.TYPE;
     }
 
     @Override
@@ -71,7 +72,7 @@ public class BDBMessageStoreFactory impl
 
         if(initialSize != 0)
         {
-            return Collections.singletonMap("bdbEnvironmentConfig", (Object)attributes);
+            return Collections.singletonMap(BDBMessageStore.ENVIRONMENT_CONFIGURATION, (Object)attributes);
         }
         else
         {

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/EnvironmentFacade.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/EnvironmentFacade.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/EnvironmentFacade.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/EnvironmentFacade.java Wed Jan 22 16:08:18 2014
@@ -56,4 +56,6 @@ public interface EnvironmentFacade
 
     void close();
 
+    String getStoreLocation();
+
 }

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/EnvironmentFacadeFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/EnvironmentFacadeFactory.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/EnvironmentFacadeFactory.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/EnvironmentFacadeFactory.java Wed Jan 22 16:08:18 2014
@@ -25,6 +25,8 @@ import org.apache.qpid.server.model.Virt
 public interface EnvironmentFacadeFactory
 {
 
-    EnvironmentFacade createEnvironmentFacade(String storeLocation, VirtualHost virtualHost);
+    EnvironmentFacade createEnvironmentFacade(VirtualHost virtualHost, boolean isMessageStore);
+
+    String getType();
 
 }

Copied: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/LoggingAsyncExceptionListener.java (from r1560333, qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/NoopReplicationGroupListener.java)
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/LoggingAsyncExceptionListener.java?p2=qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/LoggingAsyncExceptionListener.java&p1=qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/NoopReplicationGroupListener.java&r1=1560333&r2=1560400&rev=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/NoopReplicationGroupListener.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/LoggingAsyncExceptionListener.java Wed Jan 22 16:08:18 2014
@@ -20,23 +20,18 @@
  */
 package org.apache.qpid.server.store.berkeleydb;
 
-import org.apache.qpid.server.model.ReplicationNode;
-import org.apache.qpid.server.replication.ReplicationGroupListener;
+import org.apache.log4j.Logger;
 
-class NoopReplicationGroupListener implements ReplicationGroupListener
-{
-    @Override
-    public void onReplicationNodeRecovered(ReplicationNode node)
-    {
-    }
+import com.sleepycat.je.ExceptionEvent;
+import com.sleepycat.je.ExceptionListener;
 
-    @Override
-    public void onReplicationNodeAddedToGroup(ReplicationNode node)
-    {
-    }
+public class LoggingAsyncExceptionListener implements ExceptionListener
+{
+    private static final Logger LOGGER  = Logger.getLogger(LoggingAsyncExceptionListener.class);
 
     @Override
-    public void onReplicationNodeRemovedFromGroup(ReplicationNode node)
+    public void exceptionThrown(ExceptionEvent event)
     {
+        LOGGER.error("Asynchronous exception thrown by BDB thread '" + event.getThreadName() + "'", event.getException());
     }
 }
\ No newline at end of file

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacade.java Wed Jan 22 16:08:18 2014
@@ -32,21 +32,35 @@ import com.sleepycat.je.DatabaseConfig;
 import com.sleepycat.je.DatabaseException;
 import com.sleepycat.je.Environment;
 import com.sleepycat.je.EnvironmentConfig;
-import com.sleepycat.je.ExceptionEvent;
-import com.sleepycat.je.ExceptionListener;
 
 public class StandardEnvironmentFacade implements EnvironmentFacade
 {
     private static final Logger LOGGER = Logger.getLogger(StandardEnvironmentFacade.class);
     public static final String TYPE = "BDB";
 
-    private Environment _environment;
+    private final String _storePath;
     private final Map<String, Database> _databases = new HashMap<String, Database>();
 
+    private Environment _environment;
+
     public StandardEnvironmentFacade(String storePath, Map<String, String> attributes)
     {
+        _storePath = storePath;
 
-        LOGGER.info("BDB message store using environment path " + storePath);
+        if (LOGGER.isInfoEnabled())
+        {
+            LOGGER.info("Creating environment at environment path " + _storePath);
+        }
+
+        File environmentPath = new File(storePath);
+        if (!environmentPath.exists())
+        {
+            if (!environmentPath.mkdirs())
+            {
+                throw new IllegalArgumentException("Environment path " + environmentPath + " could not be read or created. "
+                                                   + "Ensure the path is correct and that the permissions are correct.");
+            }
+        }
 
         EnvironmentConfig envConfig = new EnvironmentConfig();
         envConfig.setAllowCreate(true);
@@ -60,26 +74,9 @@ public class StandardEnvironmentFacade i
 
         envConfig.setExceptionListener(new LoggingAsyncExceptionListener());
 
-        try
-        {
-            _environment = new Environment(new File(storePath), envConfig);
-        }
-        catch (DatabaseException de)
-        {
-            if (de.getMessage().contains("Environment.setAllowCreate is false"))
-            {
-                // Allow the creation this time
-                envConfig.setAllowCreate(true);
-                _environment = new Environment(new File(storePath), envConfig);
-            }
-            else
-            {
-                throw de;
-            }
-        }
+        _environment = new Environment(environmentPath, envConfig);
     }
 
-
     @Override
     public void commit(com.sleepycat.je.Transaction tx) throws AMQStoreException
     {
@@ -196,15 +193,6 @@ public class StandardEnvironmentFacade i
         return new AMQStoreException(contextMessage, e);
     }
 
-    private class LoggingAsyncExceptionListener implements ExceptionListener
-    {
-        @Override
-        public void exceptionThrown(ExceptionEvent event)
-        {
-            LOGGER.error("Asynchronous exception thrown by BDB thread '" + event.getThreadName() + "'", event.getException());
-        }
-    }
-
     @Override
     public void openDatabases(DatabaseConfig dbConfig, String... databaseNames)
     {
@@ -232,4 +220,10 @@ public class StandardEnvironmentFacade i
         return new CoalescingCommiter(name, this);
     }
 
+    @Override
+    public String getStoreLocation()
+    {
+        return _storePath;
+    }
+
 }

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeFactory.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeFactory.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeFactory.java Wed Jan 22 16:08:18 2014
@@ -20,9 +20,11 @@
  */
 package org.apache.qpid.server.store.berkeleydb;
 
+import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.qpid.server.configuration.BrokerProperties;
 import org.apache.qpid.server.model.VirtualHost;
 
 public class StandardEnvironmentFacadeFactory implements EnvironmentFacadeFactory
@@ -30,17 +32,45 @@ public class StandardEnvironmentFacadeFa
 
     @SuppressWarnings("unchecked")
     @Override
-    public EnvironmentFacade createEnvironmentFacade(String storePath, VirtualHost virtualHost)
+    public EnvironmentFacade createEnvironmentFacade(VirtualHost virtualHost, boolean isMessageStore)
     {
         Map<String, String> envConfigMap = new HashMap<String, String>();
         envConfigMap.putAll(EnvironmentFacade.ENVCONFIG_DEFAULTS);
 
-        Object bdbEnvConfigAttr = virtualHost.getAttribute("bdbEnvironmentConfig");
-        if (bdbEnvConfigAttr instanceof Map)
+        Object environmentConfigurationAttributes = virtualHost.getAttribute(BDBMessageStore.ENVIRONMENT_CONFIGURATION);
+        if (environmentConfigurationAttributes instanceof Map)
         {
-            envConfigMap.putAll((Map<String, String>) bdbEnvConfigAttr);
+            envConfigMap.putAll((Map<String, String>) environmentConfigurationAttributes);
         }
-        return new StandardEnvironmentFacade(storePath, envConfigMap);
+
+        String name = virtualHost.getName();
+        final String defaultPath = System.getProperty(BrokerProperties.PROPERTY_QPID_WORK) + File.separator + "bdbstore" + File.separator + name;
+
+        String storeLocation;
+        if(isMessageStore)
+        {
+            storeLocation = (String) virtualHost.getAttribute(VirtualHost.STORE_PATH);
+            if(storeLocation == null)
+            {
+                storeLocation = defaultPath;
+            }
+        }
+        else // we are acting only as the durable config store
+        {
+            storeLocation = (String) virtualHost.getAttribute(VirtualHost.CONFIG_STORE_PATH);
+            if(storeLocation == null)
+            {
+                storeLocation = defaultPath;
+            }
+        }
+
+        return new StandardEnvironmentFacade(storeLocation, envConfigMap);
+    }
+
+    @Override
+    public String getType()
+    {
+        return StandardEnvironmentFacade.TYPE;
     }
 
 }

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/DatabasePinger.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/DatabasePinger.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/DatabasePinger.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/DatabasePinger.java Wed Jan 22 16:08:18 2014
@@ -25,7 +25,6 @@ import org.apache.qpid.server.store.berk
 import com.sleepycat.bind.tuple.IntegerBinding;
 import com.sleepycat.bind.tuple.LongBinding;
 import com.sleepycat.je.Database;
-import com.sleepycat.je.DatabaseConfig;
 import com.sleepycat.je.DatabaseEntry;
 import com.sleepycat.je.DatabaseException;
 import com.sleepycat.je.Transaction;
@@ -35,7 +34,6 @@ public class DatabasePinger
     public static final String PING_DATABASE_NAME = "PINGDB";
     private static final int ID = 0;
 
-
     public void pingDb(EnvironmentFacade facade)
     {
         try

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/LocalReplicationNode.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/LocalReplicationNode.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/LocalReplicationNode.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/LocalReplicationNode.java Wed Jan 22 16:08:18 2014
@@ -37,7 +37,6 @@ import org.apache.qpid.server.model.Stat
 import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.model.adapter.AbstractAdapter;
 import org.apache.qpid.server.model.adapter.NoStatistics;
-import org.apache.qpid.server.store.berkeleydb.ReplicatedEnvironmentFacade;
 import org.apache.qpid.server.util.MapValueConverter;
 import org.apache.qpid.server.util.ParameterizedTypeImpl;
 
@@ -110,6 +109,11 @@ public class LocalReplicationNode extend
         {
             throw new IllegalConfigurationException("Helper host and port attribute is not specified");
         }
+        Object storePath = attributes.get(STORE_PATH);
+        if (storePath == null || storePath.equals(""))
+        {
+            throw new IllegalConfigurationException("Store path is not specified for the replication node");
+        }
         return attributes;
     }
 

Copied: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java (from r1560333, qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacade.java)
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java?p2=qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java&p1=qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacade.java&r1=1560333&r2=1560400&rev=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacade.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java Wed Jan 22 16:08:18 2014
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-package org.apache.qpid.server.store.berkeleydb;
+package org.apache.qpid.server.store.berkeleydb.replication;
 
 import static org.apache.qpid.server.model.ReplicationNode.COALESCING_SYNC;
 import static org.apache.qpid.server.model.ReplicationNode.DESIGNATED_PRIMARY;
@@ -28,6 +28,7 @@ import static org.apache.qpid.server.mod
 import static org.apache.qpid.server.model.ReplicationNode.HOST_PORT;
 import static org.apache.qpid.server.model.ReplicationNode.PARAMETERS;
 import static org.apache.qpid.server.model.ReplicationNode.REPLICATION_PARAMETERS;
+import static org.apache.qpid.server.model.ReplicationNode.STORE_PATH;
 
 import java.io.File;
 import java.net.InetSocketAddress;
@@ -53,9 +54,10 @@ import java.util.concurrent.atomic.Atomi
 import org.apache.log4j.Logger;
 import org.apache.qpid.AMQStoreException;
 import org.apache.qpid.server.replication.ReplicationGroupListener;
-import org.apache.qpid.server.store.berkeleydb.replication.DatabasePinger;
-import org.apache.qpid.server.store.berkeleydb.replication.RemoteReplicationNode;
-import org.apache.qpid.server.store.berkeleydb.replication.RemoteReplicationNodeFactory;
+import org.apache.qpid.server.store.berkeleydb.CoalescingCommiter;
+import org.apache.qpid.server.store.berkeleydb.Committer;
+import org.apache.qpid.server.store.berkeleydb.EnvironmentFacade;
+import org.apache.qpid.server.store.berkeleydb.LoggingAsyncExceptionListener;
 import org.apache.qpid.server.util.DaemonThreadFactory;
 
 import com.sleepycat.je.Database;
@@ -65,8 +67,6 @@ import com.sleepycat.je.Durability;
 import com.sleepycat.je.Environment;
 import com.sleepycat.je.EnvironmentConfig;
 import com.sleepycat.je.EnvironmentFailureException;
-import com.sleepycat.je.ExceptionEvent;
-import com.sleepycat.je.ExceptionListener;
 import com.sleepycat.je.OperationFailureException;
 import com.sleepycat.je.Transaction;
 import com.sleepycat.je.rep.InsufficientLogException;
@@ -81,6 +81,7 @@ import com.sleepycat.je.rep.ReplicationN
 import com.sleepycat.je.rep.StateChangeEvent;
 import com.sleepycat.je.rep.StateChangeListener;
 import com.sleepycat.je.rep.util.ReplicationGroupAdmin;
+import com.sleepycat.je.utilint.PropUtil;
 
 public class ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener
 {
@@ -141,12 +142,12 @@ public class ReplicatedEnvironmentFacade
     private final Durability _durability;
     private final boolean _designatedPrimary;
     private final boolean _coalescingSync;
-    private final String _environmentPath;
+    private final File _environmentDirectory;
     private final Map<String, String> _environmentParameters;
     private final Map<String, String> _replicationEnvironmentParameters;
     private final ExecutorService _restartEnvironmentExecutor;
     private final ScheduledExecutorService _groupChangeExecutor;
-    private final AtomicReference<State> _state = new AtomicReference<State>(State.INITIAL);
+    private final AtomicReference<State> _state = new AtomicReference<State>(State.OPENING);
     private final ConcurrentMap<String, DatabaseHolder> _databases = new ConcurrentHashMap<String, DatabaseHolder>();
     private final ConcurrentMap<String, RemoteReplicationNode> _remoteReplicationNodes = new ConcurrentHashMap<String, RemoteReplicationNode>();
     private final RemoteReplicationNodeFactory _remoteReplicationNodeFactory;
@@ -158,10 +159,19 @@ public class ReplicatedEnvironmentFacade
     private String _lastKnownReplicationTransactionId;
 
     @SuppressWarnings("unchecked")
-    public ReplicatedEnvironmentFacade(String environmentPath, org.apache.qpid.server.model.ReplicationNode replicationNode,
+    public ReplicatedEnvironmentFacade(org.apache.qpid.server.model.ReplicationNode replicationNode,
             RemoteReplicationNodeFactory remoteReplicationNodeFactory)
     {
-        _environmentPath = environmentPath;
+        _environmentDirectory = new File((String)replicationNode.getAttribute(STORE_PATH));
+        if (!_environmentDirectory.exists())
+        {
+            if (!_environmentDirectory.mkdirs())
+            {
+                throw new IllegalArgumentException("Environment path " + _environmentDirectory + " could not be read or created. "
+                                                   + "Ensure the path is correct and that the permissions are correct.");
+            }
+        }
+
         _groupName = (String)replicationNode.getAttribute(GROUP_NAME);
         _nodeName = replicationNode.getName();
         _nodeHostPort = (String)replicationNode.getAttribute(HOST_PORT);;
@@ -177,43 +187,11 @@ public class ReplicatedEnvironmentFacade
         _groupChangeExecutor = Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors() + 1, new DaemonThreadFactory("Group-Change-Learner:" + _prettyGroupNodeName));
 
         _remoteReplicationNodeFactory = remoteReplicationNodeFactory;
-        _state.set(State.OPENING);
         _groupChangeExecutor.scheduleWithFixedDelay(new GroupChangeLearner(), 0, GROUP_CHECK_INTERVAL, TimeUnit.MILLISECONDS);
         _groupChangeExecutor.schedule(new RemoteNodeStateLearner(), _remoteReplicationNodeFactory.getRemoteNodeMonitorInterval(), TimeUnit.MILLISECONDS);
 
         // create environment in a separate thread to avoid renaming of the current thread by JE
-        Future<ReplicatedEnvironment> environmentFuture = _restartEnvironmentExecutor.submit(new Callable<ReplicatedEnvironment>(){
-            @Override
-            public ReplicatedEnvironment call() throws Exception
-            {
-                String originalThreadName = Thread.currentThread().getName();
-                try
-                {
-                    return createEnvironment();
-                }
-                finally
-                {
-                    Thread.currentThread().setName(originalThreadName);
-                }
-            }});
-
-        // TODO: evaluate the future timeout from JE ENVIRONMENT_SETUP
-        try
-        {
-            _environment = environmentFuture.get(15 * 2, TimeUnit.MINUTES);
-        }
-        catch (InterruptedException e)
-        {
-            Thread.currentThread().interrupt();
-        }
-        catch (ExecutionException e)
-        {
-            throw new RuntimeException("Unexpected exception on environment creation", e.getCause());
-        }
-        catch (TimeoutException e)
-        {
-            throw new RuntimeException("JE environment has not been created in due time");
-        }
+        _environment = createEnvironment(true);
         populateExistingRemoteReplicationNodes();
     }
 
@@ -235,12 +213,17 @@ public class ReplicatedEnvironmentFacade
     @Override
     public void close()
     {
-        if (_state.compareAndSet(State.INITIAL, State.CLOSING) || _state.compareAndSet(State.OPENING, State.CLOSING) ||
-                _state.compareAndSet(State.OPEN, State.CLOSING) || _state.compareAndSet(State.RESTARTING, State.CLOSING) )
+        if (_state.compareAndSet(State.OPENING, State.CLOSING) ||
+                _state.compareAndSet(State.OPEN, State.CLOSING) ||
+                _state.compareAndSet(State.RESTARTING, State.CLOSING) )
         {
             try
             {
-                LOGGER.debug("Closing replicated environment facade for " + _prettyGroupNodeName);
+                if (LOGGER.isDebugEnabled())
+                {
+                    LOGGER.debug("Closing replicated environment facade for " + _prettyGroupNodeName);
+                }
+
                 _restartEnvironmentExecutor.shutdown();
                 _groupChangeExecutor.shutdown();
                 closeDatabases();
@@ -321,7 +304,6 @@ public class ReplicatedEnvironmentFacade
 
     private void openDatabaseInternally(String databaseName, DatabaseHolder holder)
     {
-        LOGGER.debug("Opening database " + databaseName + " on " + _prettyGroupNodeName);
         Database database = _environment.openDatabase(null, databaseName, holder.getConfig());
         holder.setDatabase(database);
     }
@@ -352,6 +334,12 @@ public class ReplicatedEnvironmentFacade
     }
 
     @Override
+    public String getStoreLocation()
+    {
+        return _environmentDirectory.getAbsolutePath();
+    }
+
+    @Override
     public void stateChange(final StateChangeEvent stateChangeEvent)
     {
         _groupChangeExecutor.submit(new Runnable()
@@ -381,7 +369,7 @@ public class ReplicatedEnvironmentFacade
         {
             reopenDatabases();
             StateChangeListener listener = _stateChangeListener.get();
-            LOGGER.debug("Application state change listener " + listener);
+
             if (listener != null)
             {
                 listener.stateChange(stateChangeEvent);
@@ -652,7 +640,7 @@ public class ReplicatedEnvironmentFacade
 
         closeEnvironmentSafely();
 
-        _environment = createEnvironment();
+        _environment = createEnvironment(false);
 
         if (_stateChangeListener.get() != null)
         {
@@ -692,7 +680,6 @@ public class ReplicatedEnvironmentFacade
     private void closeDatabases()
     {
         RuntimeException firstThrownException = null;
-        LOGGER.debug("Closing databases " + _databases);
         for (Map.Entry<String, DatabaseHolder> entry : _databases.entrySet())
         {
             DatabaseHolder databaseHolder = entry.getValue();
@@ -701,7 +688,11 @@ public class ReplicatedEnvironmentFacade
             {
                 try
                 {
-                    LOGGER.debug("Closing database " + entry.getKey() + " on " + _prettyGroupNodeName);
+                    if (LOGGER.isDebugEnabled())
+                    {
+                        LOGGER.debug("Closing database " + entry.getKey() + " on " + _prettyGroupNodeName);
+                    }
+
                     database.close();
                 }
                 catch(RuntimeException e)
@@ -724,12 +715,12 @@ public class ReplicatedEnvironmentFacade
         }
     }
 
-    private ReplicatedEnvironment createEnvironment()
+    private ReplicatedEnvironment createEnvironment(boolean createEnvironmentInSeparateThread)
     {
         if (LOGGER.isInfoEnabled())
         {
             LOGGER.info("Creating environment");
-            LOGGER.info("Environment path " + _environmentPath);
+            LOGGER.info("Environment path " + _environmentDirectory.getAbsolutePath());
             LOGGER.info("Group name " + _groupName);
             LOGGER.info("Node name " + _nodeName);
             LOGGER.info("Node host port " + _nodeHostPort);
@@ -750,7 +741,7 @@ public class ReplicatedEnvironmentFacade
             environmentSettings.putAll(_environmentParameters);
         }
 
-        final ReplicationConfig replicationConfig = new ReplicationConfig(_groupName, _nodeName, _nodeHostPort);
+        ReplicationConfig replicationConfig = new ReplicationConfig(_groupName, _nodeName, _nodeHostPort);
         replicationConfig.setHelperHosts(_helperHostPort);
         replicationConfig.setDesignatedPrimary(_designatedPrimary);
 
@@ -778,8 +769,58 @@ public class ReplicatedEnvironmentFacade
             envConfig.setConfigParam(configItem.getKey(), configItem.getValue());
         }
 
+        if (createEnvironmentInSeparateThread)
+        {
+            return createEnvironmentInSeparateThread(_environmentDirectory, envConfig, replicationConfig);
+        }
+        else
+        {
+            return createEnvironment(_environmentDirectory, envConfig, replicationConfig);
+        }
+    }
+
+    private ReplicatedEnvironment createEnvironmentInSeparateThread(final File environmentPathFile, final EnvironmentConfig envConfig,
+            final ReplicationConfig replicationConfig)
+    {
+        Future<ReplicatedEnvironment> environmentFuture = _restartEnvironmentExecutor.submit(new Callable<ReplicatedEnvironment>(){
+            @Override
+            public ReplicatedEnvironment call() throws Exception
+            {
+                String originalThreadName = Thread.currentThread().getName();
+                try
+                {
+                    return createEnvironment(environmentPathFile, envConfig, replicationConfig);
+                }
+                finally
+                {
+                    Thread.currentThread().setName(originalThreadName);
+                }
+            }});
+
+        long setUpTimeOutMillis = PropUtil.parseDuration(replicationConfig.getConfigParam(ReplicationConfig.ENV_SETUP_TIMEOUT));
+        try
+        {
+            return environmentFuture.get(setUpTimeOutMillis, TimeUnit.MILLISECONDS);
+        }
+        catch (InterruptedException e)
+        {
+            Thread.currentThread().interrupt();
+            throw new RuntimeException("Environment creation was interrupted", e);
+        }
+        catch (ExecutionException e)
+        {
+            throw new RuntimeException("Unexpected exception on environment creation", e.getCause());
+        }
+        catch (TimeoutException e)
+        {
+            throw new RuntimeException("JE environment has not been created in due time");
+        }
+    }
+
+    private ReplicatedEnvironment createEnvironment(File environmentPathFile, EnvironmentConfig envConfig,
+            final ReplicationConfig replicationConfig)
+    {
         ReplicatedEnvironment environment = null;
-        File environmentPathFile = new File(_environmentPath);
         try
         {
             environment = new ReplicatedEnvironment(environmentPathFile, replicationConfig, envConfig);
@@ -875,7 +916,6 @@ public class ReplicatedEnvironmentFacade
         }
     }
 
-    //TODO: move the class into external class
     private class RemoteNodeStateLearner implements Callable<Void>
     {
         private Map<String, String> _previousGroupState = Collections.emptyMap();
@@ -944,18 +984,8 @@ public class ReplicatedEnvironmentFacade
         }
     }
 
-    private class LoggingAsyncExceptionListener implements ExceptionListener
-    {
-        @Override
-        public void exceptionThrown(ExceptionEvent event)
-        {
-            LOGGER.error("Asynchronous exception thrown by BDB thread '" + event.getThreadName() + "'", event.getException());
-        }
-    }
-
     public static enum State
     {
-        INITIAL,  // TODO unused remove
         OPENING,
         OPEN,
         RESTARTING,
@@ -995,4 +1025,5 @@ public class ReplicatedEnvironmentFacade
         }
 
     }
+
 }

Copied: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeFactory.java (from r1560333, qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacadeFactory.java)
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeFactory.java?p2=qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeFactory.java&p1=qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacadeFactory.java&r1=1560333&r2=1560400&rev=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacadeFactory.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeFactory.java Wed Jan 22 16:08:18 2014
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-package org.apache.qpid.server.store.berkeleydb;
+package org.apache.qpid.server.store.berkeleydb.replication;
 
 import java.util.Collection;
 import java.util.HashMap;
@@ -27,9 +27,8 @@ import java.util.Map;
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
 import org.apache.qpid.server.model.ReplicationNode;
 import org.apache.qpid.server.model.VirtualHost;
-import org.apache.qpid.server.store.berkeleydb.replication.LocalReplicationNode;
-import org.apache.qpid.server.store.berkeleydb.replication.RemoteReplicationNode;
-import org.apache.qpid.server.store.berkeleydb.replication.RemoteReplicationNodeFactory;
+import org.apache.qpid.server.store.berkeleydb.EnvironmentFacade;
+import org.apache.qpid.server.store.berkeleydb.EnvironmentFacadeFactory;
 
 import com.sleepycat.je.Durability;
 import com.sleepycat.je.Durability.SyncPolicy;
@@ -38,7 +37,7 @@ public class ReplicatedEnvironmentFacade
 {
 
     @Override
-    public EnvironmentFacade createEnvironmentFacade(String storeLocation, VirtualHost virtualHost)
+    public EnvironmentFacade createEnvironmentFacade(VirtualHost virtualHost, boolean isMessageStore)
     {
         Collection<ReplicationNode> replicationNodes = virtualHost.getChildren(ReplicationNode.class);
         if (replicationNodes == null || replicationNodes.size() != 1)
@@ -59,7 +58,7 @@ public class ReplicatedEnvironmentFacade
                     + "! Please set highAvailability.coalescingSync to false in store configuration.");
         }
 
-        ReplicatedEnvironmentFacade facade =  new ReplicatedEnvironmentFacade(storeLocation, localNode, new RemoteReplicationNodeFactoryImpl(virtualHost));
+        ReplicatedEnvironmentFacade facade =  new ReplicatedEnvironmentFacade(localNode, new RemoteReplicationNodeFactoryImpl(virtualHost));
         ((LocalReplicationNode)localNode).setReplicatedEnvironmentFacade(facade);
         return facade;
     }
@@ -89,4 +88,10 @@ public class ReplicatedEnvironmentFacade
             return (Long)_virtualHost.getAttribute(VirtualHost.REMOTE_REPLICATION_NODE_MONITOR_INTERVAL);
         }
     }
+
+    @Override
+    public String getType()
+    {
+        return ReplicatedEnvironmentFacade.TYPE;
+    }
 }

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreQuotaEventsTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreQuotaEventsTest.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreQuotaEventsTest.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreQuotaEventsTest.java Wed Jan 22 16:08:18 2014
@@ -65,7 +65,7 @@ public class BDBMessageStoreQuotaEventsT
         _logger.debug("Applying store specific config. overfull-sze=" + OVERFULL_SIZE + ", underfull-size=" + UNDERFULL_SIZE);
 
         Map<String,String> envMap = Collections.singletonMap("je.log.fileMax", MAX_BDB_LOG_SIZE);
-        when(virtualHost.getAttribute(eq("bdbEnvironmentConfig"))).thenReturn(envMap);
+        when(virtualHost.getAttribute(eq(BDBMessageStore.ENVIRONMENT_CONFIGURATION))).thenReturn(envMap);
         when(virtualHost.getAttribute(eq(MessageStoreConstants.OVERFULL_SIZE_ATTRIBUTE))).thenReturn(OVERFULL_SIZE);
         when(virtualHost.getAttribute(eq(MessageStoreConstants.UNDERFULL_SIZE_ATTRIBUTE))).thenReturn(UNDERFULL_SIZE);
 

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/MessageStoreCreatorTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/MessageStoreCreatorTest.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/MessageStoreCreatorTest.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/MessageStoreCreatorTest.java Wed Jan 22 16:08:18 2014
@@ -22,20 +22,15 @@ package org.apache.qpid.server.store.ber
 
 import org.apache.qpid.server.store.MessageStore;
 import org.apache.qpid.server.store.MessageStoreCreator;
-import org.apache.qpid.server.store.berkeleydb.BDBMessageStore;
 import org.apache.qpid.test.utils.QpidTestCase;
 
 public class MessageStoreCreatorTest extends QpidTestCase
 {
-    private static final String[] STORE_TYPES = {BDBMessageStore.TYPE};
-
     public void testMessageStoreCreator()
     {
         MessageStoreCreator messageStoreCreator = new MessageStoreCreator();
-        for (String type : STORE_TYPES)
-        {
-            MessageStore store = messageStoreCreator.createMessageStore(type);
-            assertNotNull("Store of type " + type + " is not created", store);
-        }
+        String type = new BDBMessageStoreFactory().getType();
+        MessageStore store = messageStoreCreator.createMessageStore(type);
+        assertNotNull("Store of type " + type + " is not created", store);
     }
 }

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeTest.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeTest.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/StandardEnvironmentFacadeTest.java Wed Jan 22 16:08:18 2014
@@ -24,7 +24,6 @@ import java.io.File;
 import java.util.Collections;
 
 import org.apache.qpid.test.utils.QpidTestCase;
-import org.apache.qpid.test.utils.TestFileUtils;
 import org.apache.qpid.util.FileUtils;
 
 import com.sleepycat.je.Database;
@@ -39,7 +38,7 @@ public class StandardEnvironmentFacadeTe
     protected void setUp() throws Exception
     {
         super.setUp();
-        _storePath = TestFileUtils.createTestDirectory("bdb", true);
+        _storePath = new File(TMP_FOLDER + File.separator + "bdb" + File.separator + getTestName());
     }
 
     protected void tearDown() throws Exception

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/VirtualHostTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/VirtualHostTest.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/VirtualHostTest.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/VirtualHostTest.java Wed Jan 22 16:08:18 2014
@@ -46,6 +46,7 @@ import org.apache.qpid.server.model.Repl
 import org.apache.qpid.server.model.State;
 import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.stats.StatisticsGatherer;
+import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade;
 import org.apache.qpid.server.util.BrokerTestHelper;
 import org.apache.qpid.server.virtualhost.StandardVirtualHostFactory;
 import org.apache.qpid.test.utils.QpidTestCase;
@@ -185,7 +186,7 @@ public class VirtualHostTest extends Qpi
         _host.setDesiredState(State.INITIALISING, State.ACTIVE);
         assertEquals("Unexpected host name", hostName, _host.getName());
         assertEquals("Unexpected host type", StandardVirtualHostFactory.TYPE, _host.getType());
-        assertEquals("Unexpected store type", BDBMessageStore.TYPE, _host.getAttribute(VirtualHost.STORE_TYPE));
+        assertEquals("Unexpected store type", new BDBMessageStoreFactory().getType(), _host.getAttribute(VirtualHost.STORE_TYPE));
         assertEquals("Unexpected store path", _bdbStorePath.getAbsolutePath(), _host.getAttribute(VirtualHost.STORE_PATH));
 
         BDBMessageStore messageStore = (BDBMessageStore) _host.getMessageStore();

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/LocalReplicationNodeTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/LocalReplicationNodeTest.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/LocalReplicationNodeTest.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/LocalReplicationNodeTest.java Wed Jan 22 16:08:18 2014
@@ -32,7 +32,6 @@ import org.apache.qpid.server.configurat
 import org.apache.qpid.server.configuration.updater.TaskExecutor;
 import org.apache.qpid.server.model.ReplicationNode;
 import org.apache.qpid.server.model.VirtualHost;
-import org.apache.qpid.server.store.berkeleydb.ReplicatedEnvironmentFacade;
 import org.apache.qpid.test.utils.QpidTestCase;
 
 public class LocalReplicationNodeTest extends QpidTestCase
@@ -184,6 +183,7 @@ public class LocalReplicationNodeTest ex
         attributes.put(ReplicationNode.GROUP_NAME, "testGroup");
         attributes.put(ReplicationNode.HOST_PORT, "localhost:5000");
         attributes.put(ReplicationNode.HELPER_HOST_PORT, "localhost:5001");
+        attributes.put(ReplicationNode.STORE_PATH, TMP_FOLDER + File.separator + getTestName());
         return attributes;
     }
 

Copied: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/NoopReplicationGroupListener.java (from r1560333, qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/NoopReplicationGroupListener.java)
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/NoopReplicationGroupListener.java?p2=qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/NoopReplicationGroupListener.java&p1=qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/NoopReplicationGroupListener.java&r1=1560333&r2=1560400&rev=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/NoopReplicationGroupListener.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/NoopReplicationGroupListener.java Wed Jan 22 16:08:18 2014
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-package org.apache.qpid.server.store.berkeleydb;
+package org.apache.qpid.server.store.berkeleydb.replication;
 
 import org.apache.qpid.server.model.ReplicationNode;
 import org.apache.qpid.server.replication.ReplicationGroupListener;

Copied: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeTest.java (from r1560333, qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacadeTest.java)
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeTest.java?p2=qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeTest.java&p1=qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacadeTest.java&r1=1560333&r2=1560400&rev=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/ReplicatedEnvironmentFacadeTest.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacadeTest.java Wed Jan 22 16:08:18 2014
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-package org.apache.qpid.server.store.berkeleydb;
+package org.apache.qpid.server.store.berkeleydb.replication;
 
 import static org.apache.qpid.server.model.ReplicationNode.COALESCING_SYNC;
 import static org.apache.qpid.server.model.ReplicationNode.DESIGNATED_PRIMARY;
@@ -28,6 +28,7 @@ import static org.apache.qpid.server.mod
 import static org.apache.qpid.server.model.ReplicationNode.HOST_PORT;
 import static org.apache.qpid.server.model.ReplicationNode.NAME;
 import static org.apache.qpid.server.model.ReplicationNode.REPLICATION_PARAMETERS;
+import static org.apache.qpid.server.model.ReplicationNode.STORE_PATH;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -47,8 +48,11 @@ import org.apache.qpid.AMQStoreException
 import org.apache.qpid.server.model.ReplicationNode;
 import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.replication.ReplicationGroupListener;
+import org.apache.qpid.server.store.berkeleydb.EnvironmentFacade;
 import org.apache.qpid.server.store.berkeleydb.replication.RemoteReplicationNode;
 import org.apache.qpid.server.store.berkeleydb.replication.RemoteReplicationNodeFactory;
+import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade;
+import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacadeFactory;
 import org.apache.qpid.test.utils.QpidTestCase;
 import org.apache.qpid.test.utils.TestFileUtils;
 import org.apache.qpid.util.FileUtils;
@@ -65,7 +69,6 @@ import com.sleepycat.je.rep.StateChangeL
 
 public class ReplicatedEnvironmentFacadeTest extends QpidTestCase
 {
-    protected File _storePath;
     private static final int TEST_NODE_PORT = new QpidTestCase().findFreePort();
     private static final int LISTENER_TIMEOUT = 5;
     private static final int WAIT_STATE_CHANGE_TIMEOUT = 30;
@@ -76,6 +79,8 @@ public class ReplicatedEnvironmentFacade
     private static final String TEST_DURABILITY = Durability.parse("NO_SYNC,NO_SYNC,SIMPLE_MAJORITY").toString();
     private static final boolean TEST_DESIGNATED_PRIMARY = false;
     private static final boolean TEST_COALESCING_SYNC = true;
+
+    private File _storePath;
     private final Map<String, ReplicatedEnvironmentFacade> _nodes = new HashMap<String, ReplicatedEnvironmentFacade>();
     private VirtualHost _virtualHost = mock(VirtualHost.class);
     private RemoteReplicationNodeFactory _remoteReplicationNodeFactory = new ReplicatedEnvironmentFacadeFactory.RemoteReplicationNodeFactoryImpl(_virtualHost);
@@ -540,24 +545,12 @@ public class ReplicatedEnvironmentFacade
         assertTrue("Replica " + nodeName + " was not started", testStateChangeListener.awaitForStateChange(LISTENER_TIMEOUT, TimeUnit.SECONDS));
         return replicaEnvironmentFacade;
     }
-
-    private String createNodeWorkingFolder(String nodeName)
-    {
-        File nodeLocation = new File(_storePath, nodeName);
-        if (!nodeLocation.exists())
-        {
-            nodeLocation.mkdirs();
-        }
-        final String nodePath = nodeLocation.getAbsolutePath();
-        return nodePath;
-    }
-
     private ReplicatedEnvironmentFacade addNode(String nodeName, String nodeHostPort, boolean designatedPrimary,
             State desiredState, StateChangeListener stateChangeListener, ReplicationGroupListener replicationGroupListener)
     {
-        final String nodePath = createNodeWorkingFolder(nodeName);
+
         ReplicationNode node = createReplicationNodeMock(nodeName, nodeHostPort, designatedPrimary);
-        ReplicatedEnvironmentFacade ref = new ReplicatedEnvironmentFacade(nodePath, node, _remoteReplicationNodeFactory);
+        ReplicatedEnvironmentFacade ref = new ReplicatedEnvironmentFacade(node, _remoteReplicationNodeFactory);
         ref.setReplicationGroupListener(replicationGroupListener);
         ref.setStateChangeListener(stateChangeListener);
         _nodes.put(nodeName, ref);
@@ -594,6 +587,8 @@ public class ReplicatedEnvironmentFacade
         repConfig.put(ReplicationConfig.REPLICA_ACK_TIMEOUT, "2 s");
         repConfig.put(ReplicationConfig.INSUFFICIENT_REPLICAS_TIMEOUT, "2 s");
         when(node.getAttribute(REPLICATION_PARAMETERS)).thenReturn(repConfig);
+
+        when(node.getAttribute(STORE_PATH)).thenReturn(new File(_storePath, nodeName).getAbsolutePath());
         return node;
     }
 }

Copied: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TestStateChangeListener.java (from r1560333, qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/TestStateChangeListener.java)
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TestStateChangeListener.java?p2=qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TestStateChangeListener.java&p1=qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/TestStateChangeListener.java&r1=1560333&r2=1560400&rev=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/TestStateChangeListener.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/replication/TestStateChangeListener.java Wed Jan 22 16:08:18 2014
@@ -18,7 +18,7 @@
  * under the License.
  *
  */
-package org.apache.qpid.server.store.berkeleydb;
+package org.apache.qpid.server.store.berkeleydb.replication;
 
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HAClusterManagementTest.java Wed Jan 22 16:08:18 2014
@@ -38,6 +38,7 @@ import org.apache.log4j.Logger;
 import org.apache.qpid.jms.ConnectionURL;
 import org.apache.qpid.management.common.mbeans.ManagedBroker;
 import org.apache.qpid.server.store.berkeleydb.jmx.ManagedBDBHAMessageStore;
+import org.apache.qpid.server.store.berkeleydb.replication.ReplicatedEnvironmentFacade;
 import org.apache.qpid.test.utils.JMXTestUtils;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 

Modified: qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java?rev=1560400&r1=1560399&r2=1560400&view=diff
==============================================================================
--- qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java (original)
+++ qpid/branches/java-broker-bdb-ha/qpid/java/bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/HATestClusterCreator.java Wed Jan 22 16:08:18 2014
@@ -19,6 +19,7 @@
  */
 package org.apache.qpid.server.store.berkeleydb;
 
+import java.io.File;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.HashMap;
@@ -41,6 +42,7 @@ import javax.jms.Connection;
 import org.apache.log4j.Logger;
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQConnectionURL;
+import org.apache.qpid.server.configuration.BrokerProperties;
 import org.apache.qpid.server.model.ReplicationNode;
 import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
@@ -69,7 +71,7 @@ public class HATestClusterCreator
     private final String _virtualHostName;
 
     private final String _ipAddressOfBroker;
-    private final String _groupName ;
+    private final String _groupName;
     private final int _numberOfNodes;
     private int _bdbHelperPort;
     private int _primaryBrokerPort;
@@ -350,6 +352,7 @@ public class HATestClusterCreator
         {
             replicationNodeAttributes.put(ReplicationNode.REPLICATION_PARAMETERS, replicationParameters);
         }
+        replicationNodeAttributes.put(ReplicationNode.STORE_PATH, System.getProperty(BrokerProperties.PROPERTY_QPID_WORK) + File.separator + nodeName);
 
         // ha virtual host
         Map<String, Object> virtualHostAttributes = new HashMap<String, Object>();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message