From acdb57af871cbfef3a768b2dd765246063129d5d Mon Sep 17 00:00:00 2001 From: Robert Godfrey Date: Sat, 8 Nov 2014 12:56:12 +0000 Subject: QPID-6221 : [Java Broker] Detect low disk space conditions and enforce flow control git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1637558 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpid/server/store/derby/DerbyConfigurationStore.java | 6 ++++++ .../java/org/apache/qpid/server/store/derby/DerbyMessageStore.java | 6 +++++- .../main/java/org/apache/qpid/server/store/derby/DerbyUtils.java | 7 ++++++- 3 files changed, 17 insertions(+), 2 deletions(-) (limited to 'qpid/java/broker-plugins/derby-store') 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 85960cd25b..2764597bd0 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 @@ -220,6 +220,12 @@ public class DerbyConfigurationStore extends AbstractJDBCConfigurationStore return ((FileBasedSettings)_parent).getStorePath(); } + @Override + public File getStoreLocationAsFile() + { + return DerbyUtils.isInMemoryDatabase(getStoreLocation()) ? null : new File(getStoreLocation()); + } + @Override protected Logger getLogger() { 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 8ba5af9130..7d1191da2c 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 @@ -109,5 +109,9 @@ public class DerbyMessageStore extends AbstractDerbyMessageStore return ((FileBasedSettings)_parent).getStorePath(); } - + @Override + public File getStoreLocationAsFile() + { + return DerbyUtils.isInMemoryDatabase(getStoreLocation()) ? null : new File(getStoreLocation()); + } } diff --git a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyUtils.java b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyUtils.java index b3c449747b..df9c48d6f9 100644 --- a/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyUtils.java +++ b/qpid/java/broker-plugins/derby-store/src/main/java/org/apache/qpid/server/store/derby/DerbyUtils.java @@ -57,7 +57,7 @@ public class DerbyUtils public static String createConnectionUrl(final String name, final String databasePath) { // Derby wont use an existing directory, so we append parent name - if (MEMORY_STORE_LOCATION.equals(databasePath)) + if (isInMemoryDatabase(databasePath)) { return "jdbc:derby:" + MEMORY_STORE_LOCATION + "/" + name + ";create=true"; } @@ -79,6 +79,11 @@ public class DerbyUtils } + public static boolean isInMemoryDatabase(final String databasePath) + { + return MEMORY_STORE_LOCATION.equals(databasePath); + } + public static void shutdownDatabase(String connectionURL) throws SQLException { try -- cgit v1.2.1