diff options
author | Andrew MacBean <macbean@apache.org> | 2014-09-17 14:10:38 +0000 |
---|---|---|
committer | Andrew MacBean <macbean@apache.org> | 2014-09-17 14:10:38 +0000 |
commit | a4c7e9a99af82e0f0493e85b80ae5b75b2e3197d (patch) | |
tree | 24e56a3d042336dc410a4809412c0723a700e825 | |
parent | 5186e947711bb39c32546a5748df16d4e467ec7f (diff) | |
download | qpid-python-a4c7e9a99af82e0f0493e85b80ae5b75b2e3197d.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/qpid@1625601 13f79535-47bb-0310-9956-ffa450edef68
5 files changed, 41 insertions, 50 deletions
diff --git a/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java b/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java index 2caa069891..59bc5aad88 100644 --- a/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java +++ b/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBConfigurationStore.java @@ -77,7 +77,6 @@ public class BDBConfigurationStore implements MessageStoreProvider, DurableConfi private EnvironmentFacade _environmentFacade; - private String _storeLocation; private ConfiguredObject<?> _parent; private final Class<? extends ConfiguredObject> _rootClass; private boolean _overwrite; @@ -106,7 +105,6 @@ public class BDBConfigurationStore implements MessageStoreProvider, DurableConfi if (_environmentFacade == null) { _environmentFacade = _environmentFacadeFactory.createEnvironmentFacade(parent); - _storeLocation = _environmentFacade.getStoreLocation(); _overwrite = overwrite; _initialRecords = initialRecords; } @@ -482,24 +480,22 @@ public class BDBConfigurationStore implements MessageStoreProvider, DurableConfi @Override public void onDelete(ConfiguredObject<?> parent) { - 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; } private boolean isConfigurationStoreOpen() @@ -570,7 +566,7 @@ public class BDBConfigurationStore implements MessageStoreProvider, DurableConfi @Override public String getStoreLocation() { - return BDBConfigurationStore.this._storeLocation; + return ((FileBasedSettings)_parent).getStorePath(); } @Override diff --git a/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java b/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java index 5facf616e5..66e98ac314 100644 --- a/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java +++ b/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java @@ -46,7 +46,6 @@ public class BDBMessageStore extends AbstractBDBMessageStore private EnvironmentFacade _environmentFacade; private ConfiguredObject<?> _parent; - private String _storeLocation; private long _persistentSizeLowThreshold; private long _persistentSizeHighThreshold; @@ -78,7 +77,6 @@ public class BDBMessageStore extends AbstractBDBMessageStore } _environmentFacade = _environmentFacadeFactory.createEnvironmentFacade(parent); - _storeLocation = _environmentFacade.getStoreLocation(); } } @@ -105,24 +103,22 @@ public class BDBMessageStore extends AbstractBDBMessageStore @Override public void onDelete(ConfiguredObject<?> parent) { - 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 @@ -167,6 +163,6 @@ public class BDBMessageStore extends AbstractBDBMessageStore @Override public String getStoreLocation() { - return _storeLocation; + return ((FileBasedSettings)_parent).getStorePath(); } } diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java b/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java index edcad2f51a..55de8f6852 100644 --- a/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java +++ b/java/broker-core/src/main/java/org/apache/qpid/server/store/JsonFileConfigStore.java @@ -586,6 +586,11 @@ public class JsonFileConfigStore implements DurableConfigurationStore if (storePath != null) { + if (_logger.isDebugEnabled()) + { + _logger.debug("Deleting store " + storePath); + } + File configFile = new File(storePath); if (!FileUtils.delete(configFile, true)) { diff --git a/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java b/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java index 31089356a8..85960cd25b 100644 --- a/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyConfigurationStore.java +++ b/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/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java b/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java index 9c6baa52ba..8ba5af9130 100644 --- a/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java +++ b/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(); } |