summaryrefslogtreecommitdiff
path: root/qpid/java/broker/src
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org>2012-05-08 18:05:40 +0000
committerRobert Godfrey <rgodfrey@apache.org>2012-05-08 18:05:40 +0000
commit23eb568f969127c848dc0f3671251944c457a850 (patch)
treeaa1f39e37ed6890ab25daa27ebb4a1ccabac5130 /qpid/java/broker/src
parent0dfb2eeb048361461538c2223cb26bf036c513c3 (diff)
downloadqpid-python-23eb568f969127c848dc0f3671251944c457a850.tar.gz
QPID-3989 : [Java Broker] Add ability to run "in-memory" Derby store
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1335667 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker/src')
-rw-r--r--qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
index 480da2246c..de1ce1a9db 100644
--- a/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
+++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/store/derby/DerbyMessageStore.java
@@ -112,6 +112,7 @@ public class DerbyMessageStore implements MessageStore
private static Class<Driver> DRIVER_CLASS;
+ public static final String MEMORY_STORE_LOCATION = ":memory:";
private final AtomicLong _messageId = new AtomicLong(0);
private AtomicBoolean _closed = new AtomicBoolean(false);
@@ -302,13 +303,16 @@ public class DerbyMessageStore implements MessageStore
final String databasePath = storeConfiguration.getString(MessageStoreConstants.ENVIRONMENT_PATH_PROPERTY, System.getProperty("QPID_WORK")
+ File.separator + "derbyDB");
- File environmentPath = new File(databasePath);
- if (!environmentPath.exists())
+ if(!MEMORY_STORE_LOCATION.equals(databasePath))
{
- if (!environmentPath.mkdirs())
+ File environmentPath = new File(databasePath);
+ if (!environmentPath.exists())
{
- throw new IllegalArgumentException("Environment path " + environmentPath + " could not be read or created. "
- + "Ensure the path is correct and that the permissions are correct.");
+ 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.");
+ }
}
}
@@ -345,7 +349,7 @@ public class DerbyMessageStore implements MessageStore
private void createOrOpenDatabase(String name, final String environmentPath) throws SQLException
{
//FIXME this the _vhost name should not be added here, but derby wont use an empty directory as was possibly just created.
- _connectionURL = "jdbc:derby:" + environmentPath + "/" + name + ";create=true";
+ _connectionURL = "jdbc:derby" + (environmentPath.equals(MEMORY_STORE_LOCATION) ? environmentPath : ":" + environmentPath + "/") + name + ";create=true";
Connection conn = newAutoCommitConnection();