summaryrefslogtreecommitdiff
path: root/qpid/java/broker-plugins
diff options
context:
space:
mode:
authorAndrew MacBean <macbean@apache.org>2014-09-17 14:10:38 +0000
committerAndrew MacBean <macbean@apache.org>2014-09-17 14:10:38 +0000
commit8f6819c5a0189dde5e16547ddd07ed6650801e55 (patch)
tree66902a7b807e69eba4da7fac46a1babfbf4d61d4 /qpid/java/broker-plugins
parent91ab214370cc16360822ebc5dbe4024a5124c453 (diff)
downloadqpid-python-8f6819c5a0189dde5e16547ddd07ed6650801e55.tar.gz
QPID-6075: [Java Broker] Deleting VHN fails to delete underlying store files if VHN has not been started
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1625601 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins')
-rw-r--r--qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java32
-rw-r--r--qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java22
2 files changed, 24 insertions, 30 deletions
diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java
index 31089356a8..85960cd25b 100644
--- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java
+++ b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java
@@ -47,7 +47,6 @@ public class DerbyConfigurationStore extends AbstractJDBCConfigurationStore
private final ProvidedMessageStore _providedMessageStore = new ProvidedMessageStore();
private String _connectionURL;
- private String _storeLocation;
private ConfiguredObject<?> _parent;
private final Class<? extends ConfiguredObject> _rootClass;
@@ -68,9 +67,7 @@ public class DerbyConfigurationStore extends AbstractJDBCConfigurationStore
_parent = parent;
DerbyUtils.loadDerbyDriver();
- final FileBasedSettings settings = (FileBasedSettings)parent;
- _storeLocation = settings.getStorePath();
- _connectionURL = DerbyUtils.createConnectionUrl(parent.getName(), _storeLocation);
+ _connectionURL = DerbyUtils.createConnectionUrl(parent.getName(), ((FileBasedSettings)_parent).getStorePath());
createOrOpenConfigurationStoreDatabase(overwrite);
@@ -148,24 +145,25 @@ public class DerbyConfigurationStore extends AbstractJDBCConfigurationStore
throw new IllegalStateException("Cannot delete the store as the provided message store is still open");
}
- if (LOGGER.isDebugEnabled())
- {
- LOGGER.debug("Deleting store " + _storeLocation);
- }
-
- FileBasedSettings fileBasedSettings = (FileBasedSettings)parent;
+ FileBasedSettings fileBasedSettings = (FileBasedSettings) parent;
String storePath = fileBasedSettings.getStorePath();
- if (storePath != null)
+ if (!DerbyUtils.MEMORY_STORE_LOCATION.equals(storePath))
{
- File configFile = new File(storePath);
- if (!FileUtils.delete(configFile, true))
+ if (storePath != null)
{
- LOGGER.info("Failed to delete the store at location " + storePath);
+ if (LOGGER.isDebugEnabled())
+ {
+ LOGGER.debug("Deleting store " + storePath);
+ }
+
+ File configFile = new File(storePath);
+ if (!FileUtils.delete(configFile, true))
+ {
+ LOGGER.info("Failed to delete the store at location " + storePath);
+ }
}
}
-
- _storeLocation = null;
}
@Override
@@ -219,7 +217,7 @@ public class DerbyConfigurationStore extends AbstractJDBCConfigurationStore
@Override
public String getStoreLocation()
{
- return DerbyConfigurationStore.this._storeLocation;
+ return ((FileBasedSettings)_parent).getStorePath();
}
@Override
diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
index 9c6baa52ba..8ba5af9130 100644
--- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
+++ b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
@@ -41,15 +41,13 @@ public class DerbyMessageStore extends AbstractDerbyMessageStore
private static final Logger LOGGER = Logger.getLogger(DerbyMessageStore.class);
private String _connectionURL;
- private String _storeLocation;
+ private ConfiguredObject<?> _parent;
@Override
protected void doOpen(final ConfiguredObject<?> parent)
{
- final FileBasedSettings settings = (FileBasedSettings)parent;
- _storeLocation = settings.getStorePath();
-
- _connectionURL = DerbyUtils.createConnectionUrl(parent.getName(), _storeLocation);
+ _parent = parent;
+ _connectionURL = DerbyUtils.createConnectionUrl(parent.getName(), ((FileBasedSettings)_parent).getStorePath());
}
@Override
@@ -80,24 +78,22 @@ public class DerbyMessageStore extends AbstractDerbyMessageStore
throw new IllegalStateException("Cannot delete the store as the provided message store is still open");
}
- if (LOGGER.isDebugEnabled())
- {
- LOGGER.debug("Deleting store " + _storeLocation);
- }
-
FileBasedSettings fileBasedSettings = (FileBasedSettings)parent;
String storePath = fileBasedSettings.getStorePath();
if (storePath != null)
{
+ if (LOGGER.isDebugEnabled())
+ {
+ LOGGER.debug("Deleting store " + storePath);
+ }
+
File configFile = new File(storePath);
if (!FileUtils.delete(configFile, true))
{
LOGGER.info("Failed to delete the store at location " + storePath);
}
}
-
- _storeLocation = null;
}
@Override
@@ -110,7 +106,7 @@ public class DerbyMessageStore extends AbstractDerbyMessageStore
@Override
public String getStoreLocation()
{
- return _storeLocation;
+ return ((FileBasedSettings)_parent).getStorePath();
}