summaryrefslogtreecommitdiff
path: root/qpid/java/bdbstore
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2012-03-30 08:55:05 +0000
committerKeith Wall <kwall@apache.org>2012-03-30 08:55:05 +0000
commitda8070494a06d0b6c37127eb0a3439e394bddd31 (patch)
tree85ca23ccf051f3157a5f4b3be1b7752dfe576c6d /qpid/java/bdbstore
parent6e605c53e91d5b9b1bf46985c5cf8bd94a34de4d (diff)
downloadqpid-python-da8070494a06d0b6c37127eb0a3439e394bddd31.tar.gz
QPID-3916: Change message store interface to extend DurableConfigurationStore and change VirtualHost contructor
Applied patch from Andrew MacBean <andymacbean@gmail.com> and myself. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1307317 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/bdbstore')
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java33
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/entry/PreparedTransaction.java12
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/PreparedTransactionBinding.java16
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java7
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java1
5 files changed, 29 insertions, 40 deletions
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
index 589f63f562..402df299fc 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
@@ -59,8 +59,10 @@ import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.MessageStoreRecoveryHandler;
import org.apache.qpid.server.store.MessageStoreRecoveryHandler.StoredMessageRecoveryHandler;
import org.apache.qpid.server.store.StorableMessageMetaData;
+import org.apache.qpid.server.store.StoreFuture;
import org.apache.qpid.server.store.StoredMemoryMessage;
import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.store.Transaction;
import org.apache.qpid.server.store.TransactionLogRecoveryHandler;
import org.apache.qpid.server.store.TransactionLogRecoveryHandler.QueueEntryRecoveryHandler;
import org.apache.qpid.server.store.TransactionLogResource;
@@ -107,7 +109,7 @@ import com.sleepycat.je.TransactionConfig;
* dequeue messages to queues. <tr><td> Generate message identifiers. </table>
*/
@SuppressWarnings({"unchecked"})
-public class BDBMessageStore implements MessageStore, DurableConfigurationStore
+public class BDBMessageStore implements MessageStore
{
private static final Logger _log = Logger.getLogger(BDBMessageStore.class);
@@ -217,8 +219,8 @@ public class BDBMessageStore implements MessageStore, DurableConfigurationStore
public void configureMessageStore(String name,
MessageStoreRecoveryHandler recoveryHandler,
- Configuration storeConfiguration,
- LogSubject logSubject) throws Exception
+ TransactionLogRecoveryHandler tlogRecoveryHandler,
+ Configuration storeConfiguration, LogSubject logSubject) throws Exception
{
CurrentActor.get().message(logSubject, MessageStoreMessages.CREATED(this.getClass().getName()));
@@ -231,29 +233,14 @@ public class BDBMessageStore implements MessageStore, DurableConfigurationStore
}
recoverMessages(recoveryHandler);
- }
- public void configureTransactionLog(String name, TransactionLogRecoveryHandler recoveryHandler,
- Configuration storeConfiguration, LogSubject logSubject) throws Exception
- {
CurrentActor.get().message(logSubject, TransactionLogMessages.CREATED(this.getClass().getName()));
-
- if(!_configured)
- {
- _logSubject = logSubject;
- configure(name,storeConfiguration);
- _configured = true;
- stateTransition(State.CONFIGURING, State.CONFIGURED);
- }
-
- recoverQueueEntries(recoveryHandler);
-
-
-
+ recoverQueueEntries(tlogRecoveryHandler);
}
- public org.apache.qpid.server.store.MessageStore.Transaction newTransaction()
+
+ public org.apache.qpid.server.store.Transaction newTransaction()
{
return new BDBTransaction();
}
@@ -2222,7 +2209,7 @@ public class BDBMessageStore implements MessageStore, DurableConfigurationStore
BDBMessageStore.this.commit(txn,true);
}
- return IMMEDIATE_FUTURE;
+ return StoreFuture.IMMEDIATE_FUTURE;
}
public void remove()
@@ -2238,7 +2225,7 @@ public class BDBMessageStore implements MessageStore, DurableConfigurationStore
}
}
- private class BDBTransaction implements Transaction
+ private class BDBTransaction implements org.apache.qpid.server.store.Transaction
{
private com.sleepycat.je.Transaction _txn;
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/entry/PreparedTransaction.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/entry/PreparedTransaction.java
index 11ae8b89eb..eb5c4677ff 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/entry/PreparedTransaction.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/entry/PreparedTransaction.java
@@ -21,25 +21,25 @@
package org.apache.qpid.server.store.berkeleydb.entry;
-import org.apache.qpid.server.store.MessageStore;
+import org.apache.qpid.server.store.Transaction;
public class PreparedTransaction
{
- private final MessageStore.Transaction.Record[] _enqueues;
- private final MessageStore.Transaction.Record[] _dequeues;
+ private final Transaction.Record[] _enqueues;
+ private final Transaction.Record[] _dequeues;
- public PreparedTransaction(MessageStore.Transaction.Record[] enqueues, MessageStore.Transaction.Record[] dequeues)
+ public PreparedTransaction(Transaction.Record[] enqueues, Transaction.Record[] dequeues)
{
_enqueues = enqueues;
_dequeues = dequeues;
}
- public MessageStore.Transaction.Record[] getEnqueues()
+ public Transaction.Record[] getEnqueues()
{
return _enqueues;
}
- public MessageStore.Transaction.Record[] getDequeues()
+ public Transaction.Record[] getDequeues()
{
return _dequeues;
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/PreparedTransactionBinding.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/PreparedTransactionBinding.java
index d85bcd361e..33bf269880 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/PreparedTransactionBinding.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/PreparedTransactionBinding.java
@@ -25,8 +25,8 @@ import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;
import org.apache.qpid.server.message.EnqueableMessage;
-import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.store.Transaction;
import org.apache.qpid.server.store.TransactionLogResource;
import org.apache.qpid.server.store.berkeleydb.entry.PreparedTransaction;
@@ -35,16 +35,16 @@ public class PreparedTransactionBinding extends TupleBinding<PreparedTransaction
@Override
public PreparedTransaction entryToObject(TupleInput input)
{
- MessageStore.Transaction.Record[] enqueues = readRecords(input);
+ Transaction.Record[] enqueues = readRecords(input);
- MessageStore.Transaction.Record[] dequeues = readRecords(input);
+ Transaction.Record[] dequeues = readRecords(input);
return new PreparedTransaction(enqueues, dequeues);
}
- private MessageStore.Transaction.Record[] readRecords(TupleInput input)
+ private Transaction.Record[] readRecords(TupleInput input)
{
- MessageStore.Transaction.Record[] records = new MessageStore.Transaction.Record[input.readInt()];
+ Transaction.Record[] records = new Transaction.Record[input.readInt()];
for(int i = 0; i < records.length; i++)
{
records[i] = new RecordImpl(input.readString(), input.readLong());
@@ -60,7 +60,7 @@ public class PreparedTransactionBinding extends TupleBinding<PreparedTransaction
}
- private void writeRecords(MessageStore.Transaction.Record[] records, TupleOutput output)
+ private void writeRecords(Transaction.Record[] records, TupleOutput output)
{
if(records == null)
{
@@ -69,7 +69,7 @@ public class PreparedTransactionBinding extends TupleBinding<PreparedTransaction
else
{
output.writeInt(records.length);
- for(MessageStore.Transaction.Record record : records)
+ for(Transaction.Record record : records)
{
output.writeString(record.getQueue().getResourceName());
output.writeLong(record.getMessage().getMessageNumber());
@@ -77,7 +77,7 @@ public class PreparedTransactionBinding extends TupleBinding<PreparedTransaction
}
}
- private static class RecordImpl implements MessageStore.Transaction.Record, TransactionLogResource, EnqueableMessage
+ private static class RecordImpl implements Transaction.Record, TransactionLogResource, EnqueableMessage
{
private final String _queueName;
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
index 74fba168a9..0ccfbe5a2a 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
@@ -37,6 +37,7 @@ import org.apache.qpid.server.store.MessageMetaDataType;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.StorableMessageMetaData;
import org.apache.qpid.server.store.StoredMessage;
+import org.apache.qpid.server.store.Transaction;
import org.apache.qpid.server.store.TransactionLogResource;
import org.apache.qpid.transport.DeliveryProperties;
import org.apache.qpid.transport.Header;
@@ -419,7 +420,7 @@ public class BDBMessageStoreTest extends org.apache.qpid.server.store.MessageSto
}
};
- MessageStore.Transaction txn = log.newTransaction();
+ Transaction txn = log.newTransaction();
txn.enqueueMessage(mockQueue, new MockMessage(1L));
txn.enqueueMessage(mockQueue, new MockMessage(5L));
@@ -457,7 +458,7 @@ public class BDBMessageStoreTest extends org.apache.qpid.server.store.MessageSto
}
};
- MessageStore.Transaction txn = log.newTransaction();
+ Transaction txn = log.newTransaction();
txn.enqueueMessage(mockQueue, new MockMessage(21L));
txn.abortTran();
@@ -498,7 +499,7 @@ public class BDBMessageStoreTest extends org.apache.qpid.server.store.MessageSto
}
};
- MessageStore.Transaction txn = log.newTransaction();
+ Transaction txn = log.newTransaction();
txn.enqueueMessage(mockQueue, new MockMessage(30L));
txn.commitTran();
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
index b906ab2474..4e201d5473 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
@@ -20,6 +20,7 @@
*/
package org.apache.qpid.server.store.berkeleydb;
+
import static org.apache.qpid.server.store.berkeleydb.BDBStoreUpgradeTestPreparer.NON_DURABLE_QUEUE_NAME;
import static org.apache.qpid.server.store.berkeleydb.BDBStoreUpgradeTestPreparer.QUEUE_NAME;
import static org.apache.qpid.server.store.berkeleydb.BDBStoreUpgradeTestPreparer.SELECTOR_SUB_NAME;