summaryrefslogtreecommitdiff
path: root/qpid/java/bdbstore/src
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org>2014-02-14 10:52:47 +0000
committerRobert Godfrey <rgodfrey@apache.org>2014-02-14 10:52:47 +0000
commit50b314a51a2c787fcd412a84cb8464f72e3868b4 (patch)
treefa6e85db6da742fbb9b235ca3e1d036d288ae970 /qpid/java/bdbstore/src
parent08b64b592cb844cbd746b33e5f17c94b2158a115 (diff)
downloadqpid-python-50b314a51a2c787fcd412a84cb8464f72e3868b4.tar.gz
QPID-5551 : Remove uses of AMQException, add ServerScopedRuntimeException and ConnectionScopedRuntimeException
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1568235 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/bdbstore/src')
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java129
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java11
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java30
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java12
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java2
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java15
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CommitThreadWrapper.java3
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java3
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java9
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/StoreUpgrade.java5
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java51
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java68
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom6To7.java6
-rw-r--r--qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java20
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java3
-rw-r--r--qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgraderFailOnNewerVersionTest.java12
16 files changed, 179 insertions, 200 deletions
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
index 35efa55569..53365e6b96 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/AbstractBDBMessageStore.java
@@ -44,7 +44,7 @@ import java.util.concurrent.atomic.AtomicLong;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.message.EnqueueableMessage;
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.queue.AMQQueue;
@@ -62,6 +62,7 @@ import org.apache.qpid.server.store.berkeleydb.tuple.QueueEntryBinding;
import org.apache.qpid.server.store.berkeleydb.tuple.UUIDTupleBinding;
import org.apache.qpid.server.store.berkeleydb.tuple.XidBinding;
import org.apache.qpid.server.store.berkeleydb.upgrade.Upgrader;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.util.FileUtils;
public abstract class AbstractBDBMessageStore implements MessageStore, DurableConfigurationStore
@@ -157,7 +158,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
_eventManager.addEventListener(eventListener, events);
}
- public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler) throws Exception
+ public void configureConfigStore(VirtualHost virtualHost, ConfigurationRecoveryHandler recoveryHandler)
{
_stateManager.attainState(State.INITIALISING);
@@ -166,7 +167,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler messageRecoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
+ TransactionLogRecoveryHandler tlogRecoveryHandler)
{
if(_stateManager.isInState(State.INITIAL))
{
@@ -181,14 +182,14 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
completeInitialisation();
}
- private void completeInitialisation() throws Exception
+ private void completeInitialisation()
{
configure(_virtualHost);
_stateManager.attainState(State.INITIALISED);
}
- public synchronized void activate() throws Exception
+ public synchronized void activate()
{
// check if acting as a durable config store, but not a message store
if(_stateManager.isInState(State.INITIALISING))
@@ -228,12 +229,12 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
*
* @throws Exception If any error occurs that means the store is unable to configure itself.
*/
- public void configure(VirtualHost virtualHost) throws Exception
+ public void configure(VirtualHost virtualHost)
{
configure(virtualHost, _messageRecoveryHandler != null);
}
- public void configure(VirtualHost virtualHost, boolean isMessageStore) throws Exception
+ public void configure(VirtualHost virtualHost, boolean isMessageStore)
{
String name = virtualHost.getName();
final String defaultPath = System.getProperty("QPID_WORK") + File.separator + "bdbstore" + File.separator + name;
@@ -337,7 +338,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
_stateManager.attainState(State.ACTIVE);
}
- protected void setupStore(File storePath, String name) throws DatabaseException, AMQStoreException
+ protected void setupStore(File storePath, String name)
{
_environment = createEnvironment(storePath);
@@ -387,7 +388,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
*
* @throws Exception If the close fails.
*/
- public void close() throws Exception
+ public void close()
{
if (_closed.compareAndSet(false, true))
{
@@ -397,7 +398,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
}
- protected void closeInternal() throws Exception
+ protected void closeInternal()
{
if (_messageMetaDataDb != null)
{
@@ -472,7 +473,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
- private void recoverConfig(ConfigurationRecoveryHandler recoveryHandler) throws AMQStoreException
+ private void recoverConfig(ConfigurationRecoveryHandler recoveryHandler)
{
try
{
@@ -488,7 +489,11 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
catch (DatabaseException e)
{
- throw new AMQStoreException("Error recovering persistent state: " + e.getMessage(), e);
+ throw new ServerScopedRuntimeException("Error recovering persistent state: " + e.getMessage(), e);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("Error recovering persistent state: " + e.getMessage(), e);
}
}
@@ -1385,7 +1390,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
int size = dataAsBytes.length;
if (offset > size)
{
- throw new RuntimeException("Offset " + offset + " is greater than message size " + size
+ throw new ServerScopedRuntimeException("Offset " + offset + " is greater than message size " + size
+ " for message id " + messageId + "!");
}
@@ -1537,7 +1542,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
catch (AMQStoreException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
_metaDataRef = new SoftReference<StorableMessageMetaData>(metaData);
}
@@ -1590,7 +1595,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
catch (AMQStoreException e)
{
// TODO maybe should throw a checked exception, or at least log before throwing
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
}
@@ -1625,16 +1630,11 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
catch(DatabaseException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
catch (AMQStoreException e)
{
- throw new RuntimeException(e);
- }
- catch (RuntimeException e)
- {
- LOGGER.error("RuntimeException during store", e);
- throw e;
+ throw new ServerScopedRuntimeException(e);
}
finally
{
@@ -1667,7 +1667,7 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
}
catch (AMQStoreException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
@@ -1693,11 +1693,11 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
LOGGER.error("Exception during transaction begin, closing store environment.", e);
closeEnvironmentSafely();
- throw new RuntimeException("Exception during transaction begin, store environment closed.", e);
+ throw new ServerScopedRuntimeException("Exception during transaction begin, store environment closed.", e);
}
}
- public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void enqueueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
if(message.getStoredMessage() instanceof StoredBDBMessage)
{
@@ -1706,40 +1706,89 @@ public abstract class AbstractBDBMessageStore implements MessageStore, DurableCo
_storeSizeIncrease += storedMessage.getMetaData().getContentSize();
}
- AbstractBDBMessageStore.this.enqueueMessage(_txn, queue, message.getMessageNumber());
+ try
+ {
+ AbstractBDBMessageStore.this.enqueueMessage(_txn, queue, message.getMessageNumber());
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
- public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message) throws AMQStoreException
+ public void dequeueMessage(TransactionLogResource queue, EnqueueableMessage message)
{
- AbstractBDBMessageStore.this.dequeueMessage(_txn, queue, message.getMessageNumber());
+ try
+ {
+ AbstractBDBMessageStore.this.dequeueMessage(_txn, queue, message.getMessageNumber());
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
- public void commitTran() throws AMQStoreException
+ public void commitTran()
{
- AbstractBDBMessageStore.this.commitTranImpl(_txn, true);
- AbstractBDBMessageStore.this.storedSizeChange(_storeSizeIncrease);
+ try
+ {
+ AbstractBDBMessageStore.this.commitTranImpl(_txn, true);
+ AbstractBDBMessageStore.this.storedSizeChange(_storeSizeIncrease);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
- public StoreFuture commitTranAsync() throws AMQStoreException
+ public StoreFuture commitTranAsync()
{
- AbstractBDBMessageStore.this.storedSizeChange(_storeSizeIncrease);
- return AbstractBDBMessageStore.this.commitTranImpl(_txn, false);
+ try
+ {
+ AbstractBDBMessageStore.this.storedSizeChange(_storeSizeIncrease);
+ return AbstractBDBMessageStore.this.commitTranImpl(_txn, false);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
- public void abortTran() throws AMQStoreException
+ public void abortTran()
{
- AbstractBDBMessageStore.this.abortTran(_txn);
+ try
+ {
+ AbstractBDBMessageStore.this.abortTran(_txn);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
- public void removeXid(long format, byte[] globalId, byte[] branchId) throws AMQStoreException
+ public void removeXid(long format, byte[] globalId, byte[] branchId)
{
- AbstractBDBMessageStore.this.removeXid(_txn, format, globalId, branchId);
+ try
+ {
+ AbstractBDBMessageStore.this.removeXid(_txn, format, globalId, branchId);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
public void recordXid(long format, byte[] globalId, byte[] branchId, Record[] enqueues,
- Record[] dequeues) throws AMQStoreException
+ Record[] dequeues)
{
- AbstractBDBMessageStore.this.recordXid(_txn, format, globalId, branchId, enqueues, dequeues);
+ try
+ {
+ AbstractBDBMessageStore.this.recordXid(_txn, format, globalId, branchId, enqueues, dequeues);
+ }
+ catch (AMQStoreException e)
+ {
+ throw new ServerScopedRuntimeException("A problem has been encountered with the message store", e);
+ }
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java
index 9b97fec479..fee1629743 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java
@@ -26,6 +26,7 @@ import com.sleepycat.je.EnvironmentConfig;
import com.sleepycat.je.util.DbBackup;
import org.apache.log4j.Logger;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.util.CommandLineParser;
import org.apache.qpid.util.FileUtils;
@@ -249,7 +250,7 @@ public class BDBBackup
if (fileSet.length == 0)
{
- throw new RuntimeException("There are no BDB log files to backup in the " + fromdir + " directory.");
+ throw new ServerScopedRuntimeException("There are no BDB log files to backup in the " + fromdir + " directory.");
}
for (int i = 0; i < fileSet.length; i++)
@@ -272,7 +273,7 @@ public class BDBBackup
catch (IOException ioEx)
{
// Rethrow this as a runtime exception, as something strange has happened.
- throw new RuntimeException(ioEx);
+ throw new ServerScopedRuntimeException(ioEx);
}
}
}
@@ -292,7 +293,7 @@ public class BDBBackup
long now = System.currentTimeMillis();
if ((now - start) > TIMEOUT)
{
- throw new RuntimeException("Hot backup script failed to complete in " + (TIMEOUT / 1000) + " seconds.");
+ throw new ServerScopedRuntimeException("Hot backup script failed to complete in " + (TIMEOUT / 1000) + " seconds.");
}
}
@@ -311,7 +312,7 @@ public class BDBBackup
Throwable cause = re.getCause();
if ((cause != null) && (cause instanceof IOException))
{
- throw new RuntimeException(re.getMessage() + " fromDir:" + fromdir + " toDir:" + toDirFile, cause);
+ throw new ServerScopedRuntimeException(re.getMessage() + " fromDir:" + fromdir + " toDir:" + toDirFile, cause);
}
else
{
@@ -329,7 +330,7 @@ public class BDBBackup
catch (IOException e)
{
// Rethrow this as a runtime exception, as something strange has happened.
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java
index fb1dc1f1d3..0f33dfb325 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAMessageStore.java
@@ -35,7 +35,7 @@ import java.util.concurrent.Executors;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.store.AMQStoreException;
import org.apache.qpid.server.logging.RootMessageLogger;
import org.apache.qpid.server.logging.actors.AbstractActor;
import org.apache.qpid.server.logging.actors.CurrentActor;
@@ -65,6 +65,7 @@ import com.sleepycat.je.rep.ReplicationNode;
import com.sleepycat.je.rep.StateChangeEvent;
import com.sleepycat.je.rep.StateChangeListener;
import com.sleepycat.je.rep.util.ReplicationGroupAdmin;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMessageStore
{
@@ -122,7 +123,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
private Map<String, String> _repConfig;
@Override
- public void configure(VirtualHost virtualHost) throws Exception
+ public void configure(VirtualHost virtualHost)
{
//Mandatory configuration
_groupName = getValidatedStringAttribute(virtualHost, "haGroupName");
@@ -153,7 +154,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
if (_coalescingSync && _durability.getLocalSync() == SyncPolicy.SYNC)
{
- throw new ConfigurationException("Coalescing sync cannot be used with master sync policy " + SyncPolicy.SYNC
+ throw new ServerScopedRuntimeException("Coalescing sync cannot be used with master sync policy " + SyncPolicy.SYNC
+ "! Please set highAvailability.coalescingSync to false in store configuration.");
}
@@ -162,7 +163,6 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
private String getValidatedStringAttribute(org.apache.qpid.server.model.VirtualHost virtualHost, String attributeName)
- throws ConfigurationException
{
Object attrValue = virtualHost.getAttribute(attributeName);
if(attrValue != null)
@@ -171,7 +171,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
}
else
{
- throw new ConfigurationException("BDB HA configuration key not found. Please specify configuration attribute: "
+ throw new ServerScopedRuntimeException("BDB HA configuration key not found. Please specify configuration attribute: "
+ attributeName);
}
}
@@ -206,7 +206,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
@Override
- protected void setupStore(File storePath, String name) throws DatabaseException, AMQStoreException
+ protected void setupStore(File storePath, String name) throws DatabaseException
{
super.setupStore(storePath, name);
@@ -261,7 +261,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
@Override
public void configureMessageStore(VirtualHost virtualHost, MessageStoreRecoveryHandler messageRecoveryHandler,
- TransactionLogRecoveryHandler tlogRecoveryHandler) throws Exception
+ TransactionLogRecoveryHandler tlogRecoveryHandler)
{
super.configureMessageStore(virtualHost, messageRecoveryHandler, tlogRecoveryHandler);
@@ -271,7 +271,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
}
@Override
- public synchronized void activate() throws Exception
+ public synchronized void activate()
{
// Before proceeding, perform a log flush with an fsync
getEnvironment().flushLog(true);
@@ -441,7 +441,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
}
@Override
- protected void closeInternal() throws Exception
+ protected void closeInternal()
{
substituteNoOpStateChangeListenerOn(getReplicatedEnvironment());
@@ -449,7 +449,14 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
{
if(_coalescingSync)
{
- _commitThreadWrapper.stopCommitThread();
+ try
+ {
+ _commitThreadWrapper.stopCommitThread();
+ }
+ catch (InterruptedException e)
+ {
+ throw new ServerScopedRuntimeException(e);
+ }
}
}
finally
@@ -507,7 +514,7 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
private final Executor _executor = Executors.newSingleThreadExecutor();
@Override
- public void stateChange(StateChangeEvent stateChangeEvent) throws RuntimeException
+ public void stateChange(StateChangeEvent stateChangeEvent)
{
com.sleepycat.je.rep.ReplicatedEnvironment.State state = stateChangeEvent.getState();
@@ -645,7 +652,6 @@ public class BDBHAMessageStore extends AbstractBDBMessageStore implements HAMess
{
@Override
public void stateChange(StateChangeEvent stateChangeEvent)
- throws RuntimeException
{
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java
index bb3c7b108d..0d50df1bc6 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHost.java
@@ -48,14 +48,13 @@ public class BDBHAVirtualHost extends AbstractVirtualHost
org.apache.qpid.server.security.SecurityManager parentSecurityManager,
VirtualHostConfiguration hostConfig,
VirtualHost virtualHost)
- throws Exception
{
super(virtualHostRegistry, brokerStatisticsGatherer, parentSecurityManager, hostConfig, virtualHost);
}
- protected void initialiseStorage(VirtualHostConfiguration hostConfig, VirtualHost virtualHost) throws Exception
+ protected void initialiseStorage(VirtualHostConfiguration hostConfig, VirtualHost virtualHost)
{
_messageStore = new BDBHAMessageStore();
@@ -169,14 +168,7 @@ public class BDBHAVirtualHost extends AbstractVirtualHost
@Override
public void event(Event event)
{
- try
- {
- initialiseModel(getConfiguration());
- }
- catch (Exception e)
- {
- throw new RuntimeException("Failed to initialise virtual host after state change", e);
- }
+ initialiseModel(getConfiguration());
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java
index 3b564f33fd..7a308920b3 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBHAVirtualHostFactory.java
@@ -48,7 +48,7 @@ public class BDBHAVirtualHostFactory implements VirtualHostFactory
StatisticsGatherer brokerStatisticsGatherer,
org.apache.qpid.server.security.SecurityManager parentSecurityManager,
VirtualHostConfiguration hostConfig,
- org.apache.qpid.server.model.VirtualHost virtualHost) throws Exception
+ org.apache.qpid.server.model.VirtualHost virtualHost)
{
return new BDBHAVirtualHost(virtualHostRegistry,
brokerStatisticsGatherer,
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 4028de4b80..c9c870b996 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
@@ -23,13 +23,13 @@ package org.apache.qpid.server.store.berkeleydb;
import java.io.File;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.StoreFuture;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.EnvironmentConfig;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
/**
* BDBMessageStore implements a persistent {@link MessageStore} using the BDB high performance log.
@@ -46,7 +46,7 @@ public class BDBMessageStore extends AbstractBDBMessageStore
private CommitThreadWrapper _commitThreadWrapper;
@Override
- protected void setupStore(File storePath, String name) throws DatabaseException, AMQStoreException
+ protected void setupStore(File storePath, String name) throws DatabaseException
{
super.setupStore(storePath, name);
@@ -79,9 +79,16 @@ public class BDBMessageStore extends AbstractBDBMessageStore
}
@Override
- protected void closeInternal() throws Exception
+ protected void closeInternal()
{
- _commitThreadWrapper.stopCommitThread();
+ try
+ {
+ _commitThreadWrapper.stopCommitThread();
+ }
+ catch (InterruptedException e)
+ {
+ throw new ServerScopedRuntimeException(e);
+ }
super.closeInternal();
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CommitThreadWrapper.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CommitThreadWrapper.java
index 598d20146c..92c4259051 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CommitThreadWrapper.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/CommitThreadWrapper.java
@@ -31,6 +31,7 @@ import com.sleepycat.je.CheckpointConfig;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.Transaction;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class CommitThreadWrapper
{
@@ -139,7 +140,7 @@ public class CommitThreadWrapper
}
catch (InterruptedException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java
index a876a056fc..b8984c42ca 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java
@@ -25,6 +25,7 @@ import com.sleepycat.bind.tuple.TupleOutput;
import com.sleepycat.je.DatabaseException;
import org.apache.qpid.framing.FieldTable;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
@@ -55,7 +56,7 @@ public class FieldTableEncoding
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java
index 31cafbe74d..aa2aa2e2a3 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/tuple/ConfiguredObjectBinding.java
@@ -29,6 +29,7 @@ import org.apache.qpid.server.store.ConfiguredObjectRecord;
import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
@@ -63,7 +64,7 @@ public class ConfiguredObjectBinding extends TupleBinding<ConfiguredObjectRecord
catch (IOException e)
{
//should never happen
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
@@ -79,15 +80,15 @@ public class ConfiguredObjectBinding extends TupleBinding<ConfiguredObjectRecord
}
catch (JsonMappingException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
catch (JsonGenerationException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
catch (IOException e)
{
- throw new RuntimeException(e);
+ throw new ServerScopedRuntimeException(e);
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/StoreUpgrade.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/StoreUpgrade.java
index f73e2e5d78..adcaef35ef 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/StoreUpgrade.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/StoreUpgrade.java
@@ -20,12 +20,9 @@
*/
package org.apache.qpid.server.store.berkeleydb.upgrade;
-import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
-import org.apache.qpid.AMQStoreException;
public interface StoreUpgrade
{
- void performUpgrade(Environment environment, UpgradeInteractionHandler handler, String virtualHostName)
- throws DatabaseException, AMQStoreException;
+ void performUpgrade(Environment environment, UpgradeInteractionHandler handler, String virtualHostName);
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java
index 14793cbfd3..4cb70c1486 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom4To5.java
@@ -31,7 +31,6 @@ import java.util.List;
import java.util.Set;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.common.AMQPFilterTypes;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.framing.AMQFrameDecodingException;
@@ -53,9 +52,9 @@ import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseEntry;
-import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.Transaction;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class UpgradeFrom4To5 extends AbstractStoreUpgrade
{
@@ -75,45 +74,25 @@ public class UpgradeFrom4To5 extends AbstractStoreUpgrade
private static final Logger _logger = Logger.getLogger(UpgradeFrom4To5.class);
- public void performUpgrade(final Environment environment, final UpgradeInteractionHandler handler, String virtualHostName) throws DatabaseException, AMQStoreException
+ public void performUpgrade(final Environment environment, final UpgradeInteractionHandler handler, String virtualHostName)
{
Transaction transaction = null;
- try
- {
- reportStarting(environment, 4);
-
- transaction = environment.beginTransaction(null, null);
+ reportStarting(environment, 4);
- // find all queues which are bound to a topic exchange and which have a colon in their name
- final List<AMQShortString> potentialDurableSubs = findPotentialDurableSubscriptions(environment, transaction);
+ transaction = environment.beginTransaction(null, null);
- Set<String> existingQueues = upgradeQueues(environment, handler, potentialDurableSubs, transaction);
- upgradeQueueBindings(environment, handler, potentialDurableSubs, transaction);
- Set<Long> messagesToDiscard = upgradeDelivery(environment, existingQueues, handler, transaction);
- upgradeContent(environment, handler, messagesToDiscard, transaction);
- upgradeMetaData(environment, handler, messagesToDiscard, transaction);
- renameRemainingDatabases(environment, handler, transaction);
- transaction.commit();
+ // find all queues which are bound to a topic exchange and which have a colon in their name
+ final List<AMQShortString> potentialDurableSubs = findPotentialDurableSubscriptions(environment, transaction);
- reportFinished(environment, 5);
+ Set<String> existingQueues = upgradeQueues(environment, handler, potentialDurableSubs, transaction);
+ upgradeQueueBindings(environment, handler, potentialDurableSubs, transaction);
+ Set<Long> messagesToDiscard = upgradeDelivery(environment, existingQueues, handler, transaction);
+ upgradeContent(environment, handler, messagesToDiscard, transaction);
+ upgradeMetaData(environment, handler, messagesToDiscard, transaction);
+ renameRemainingDatabases(environment, handler, transaction);
+ transaction.commit();
- }
- catch (Exception e)
- {
- transaction.abort();
- if (e instanceof DatabaseException)
- {
- throw (DatabaseException) e;
- }
- else if (e instanceof AMQStoreException)
- {
- throw (AMQStoreException) e;
- }
- else
- {
- throw new AMQStoreException("Unexpected exception", e);
- }
- }
+ reportFinished(environment, 5);
}
private void upgradeQueueBindings(Environment environment, UpgradeInteractionHandler handler, final List<AMQShortString> potentialDurableSubs,
@@ -275,7 +254,7 @@ public class UpgradeFrom4To5 extends AbstractStoreUpgrade
}
else
{
- throw new RuntimeException("Unable is aborted!");
+ throw new ServerScopedRuntimeException("Unable is aborted!");
}
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java
index a478872ad0..bba9dbaa74 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom5To6.java
@@ -36,7 +36,6 @@ import java.util.TreeMap;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.FieldTable;
@@ -45,7 +44,6 @@ import org.apache.qpid.server.model.Exchange;
import org.apache.qpid.server.model.LifetimePolicy;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.model.UUIDGenerator;
-import org.apache.qpid.server.queue.AMQQueueFactory;
import org.apache.qpid.server.queue.QueueArgumentsConverter;
import org.apache.qpid.server.store.berkeleydb.AMQShortStringEncoding;
import org.apache.qpid.server.store.berkeleydb.FieldTableEncoding;
@@ -59,11 +57,11 @@ import com.sleepycat.je.Cursor;
import com.sleepycat.je.CursorConfig;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseEntry;
-import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.LockMode;
import com.sleepycat.je.OperationStatus;
import com.sleepycat.je.Transaction;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class UpgradeFrom5To6 extends AbstractStoreUpgrade
{
@@ -121,7 +119,6 @@ public class UpgradeFrom5To6 extends AbstractStoreUpgrade
* in "CONFIGURED_OBJECTS" table.
*/
public void performUpgrade(final Environment environment, final UpgradeInteractionHandler handler, String virtualHostName)
- throws DatabaseException, AMQStoreException
{
reportStarting(environment, 5);
upgradeMessages(environment, handler);
@@ -131,61 +128,21 @@ public class UpgradeFrom5To6 extends AbstractStoreUpgrade
}
private void upgradeConfiguredObjectsAndDependencies(Environment environment, UpgradeInteractionHandler handler, String virtualHostName)
- throws AMQStoreException
{
Transaction transaction = null;
- try
- {
- transaction = environment.beginTransaction(null, null);
- upgradeConfiguredObjects(environment, handler, transaction, virtualHostName);
- upgradeQueueEntries(environment, transaction, virtualHostName);
- upgradeXidEntries(environment, transaction, virtualHostName);
- transaction.commit();
- }
- catch (Exception e)
- {
- transaction.abort();
- if (e instanceof DatabaseException)
- {
- throw (DatabaseException) e;
- }
- else if (e instanceof AMQStoreException)
- {
- throw (AMQStoreException) e;
- }
- else
- {
- throw new AMQStoreException("Unexpected exception", e);
- }
- }
+ transaction = environment.beginTransaction(null, null);
+ upgradeConfiguredObjects(environment, handler, transaction, virtualHostName);
+ upgradeQueueEntries(environment, transaction, virtualHostName);
+ upgradeXidEntries(environment, transaction, virtualHostName);
+ transaction.commit();
}
private void upgradeMessages(final Environment environment, final UpgradeInteractionHandler handler)
- throws AMQStoreException
{
Transaction transaction = null;
- try
- {
- transaction = environment.beginTransaction(null, null);
- upgradeMessages(environment, handler, transaction);
- transaction.commit();
- }
- catch (Exception e)
- {
- transaction.abort();
- if (e instanceof DatabaseException)
- {
- throw (DatabaseException) e;
- }
- else if (e instanceof AMQStoreException)
- {
- throw (AMQStoreException) e;
- }
- else
- {
- throw new AMQStoreException("Unexpected exception", e);
- }
- }
+ transaction = environment.beginTransaction(null, null);
+ upgradeMessages(environment, handler, transaction);
+ transaction.commit();
}
private void renameDatabases(Environment environment, Transaction transaction)
@@ -207,7 +164,7 @@ public class UpgradeFrom5To6 extends AbstractStoreUpgrade
}
private void upgradeMessages(final Environment environment, final UpgradeInteractionHandler handler,
- final Transaction transaction) throws AMQStoreException
+ final Transaction transaction)
{
_logger.info("Message Contents");
if (environment.getDatabaseNames().contains(OLD_CONTENT_DB_NAME))
@@ -285,7 +242,7 @@ public class UpgradeFrom5To6 extends AbstractStoreUpgrade
return;
case ABORT:
_logger.error(message);
- throw new RuntimeException("Unable to upgrade message " + messageId);
+ throw new ServerScopedRuntimeException("Unable to upgrade message " + messageId);
}
}
@@ -356,7 +313,6 @@ public class UpgradeFrom5To6 extends AbstractStoreUpgrade
}
private void upgradeConfiguredObjects(Environment environment, UpgradeInteractionHandler handler, Transaction transaction, String virtualHostName)
- throws AMQStoreException
{
upgradeQueues(environment, transaction, virtualHostName);
upgradeExchanges(environment, transaction, virtualHostName);
@@ -640,7 +596,7 @@ public class UpgradeFrom5To6 extends AbstractStoreUpgrade
OperationStatus status = database.put(txn, key, value);
if (status != OperationStatus.SUCCESS)
{
- throw new RuntimeException("Cannot add record into " + database.getDatabaseName() + ":" + status);
+ throw new ServerScopedRuntimeException("Cannot add record into " + database.getDatabaseName() + ":" + status);
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom6To7.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom6To7.java
index e318c3586e..de25c3a6d2 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom6To7.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgradeFrom6To7.java
@@ -25,10 +25,9 @@ import com.sleepycat.bind.tuple.IntegerBinding;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseConfig;
import com.sleepycat.je.DatabaseEntry;
-import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.OperationStatus;
-import org.apache.qpid.AMQStoreException;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class UpgradeFrom6To7 extends AbstractStoreUpgrade
{
@@ -37,7 +36,6 @@ public class UpgradeFrom6To7 extends AbstractStoreUpgrade
@Override
public void performUpgrade(Environment environment, UpgradeInteractionHandler handler, String virtualHostName)
- throws DatabaseException, AMQStoreException
{
reportStarting(environment, 6);
DatabaseConfig dbConfig = new DatabaseConfig();
@@ -55,7 +53,7 @@ public class UpgradeFrom6To7 extends AbstractStoreUpgrade
OperationStatus status = versionDb.put(null, key, value);
if (status != OperationStatus.SUCCESS)
{
- throw new AMQStoreException("Error initialising config version: " + status);
+ throw new ServerScopedRuntimeException("Error initialising config version: " + status);
}
}
diff --git a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java
index e769bfae81..be6bce4d46 100644
--- a/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java
+++ b/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/upgrade/Upgrader.java
@@ -24,7 +24,6 @@ import com.sleepycat.je.Cursor;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.store.berkeleydb.AbstractBDBMessageStore;
import com.sleepycat.bind.tuple.IntegerBinding;
@@ -34,8 +33,8 @@ import com.sleepycat.je.DatabaseConfig;
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
-import com.sleepycat.je.LockMode;
import com.sleepycat.je.OperationStatus;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class Upgrader
{
@@ -50,7 +49,7 @@ public class Upgrader
_virtualHostName = virtualHostName;
}
- public void upgradeIfNecessary() throws AMQStoreException
+ public void upgradeIfNecessary()
{
boolean isEmpty = _environment.getDatabaseNames().isEmpty();
DatabaseConfig dbConfig = new DatabaseConfig();
@@ -76,7 +75,7 @@ public class Upgrader
int version = getSourceVersion(versionDb);
if(version > AbstractBDBMessageStore.VERSION)
{
- throw new AMQStoreException("Database version " + version
+ throw new ServerScopedRuntimeException("Database version " + version
+ " is higher than the most recent known version: "
+ AbstractBDBMessageStore.VERSION);
}
@@ -125,7 +124,6 @@ public class Upgrader
}
void performUpgradeFromVersion(int sourceVersion, Database versionDb)
- throws AMQStoreException
{
while(sourceVersion != AbstractBDBMessageStore.VERSION)
{
@@ -138,7 +136,7 @@ public class Upgrader
}
}
- void upgrade(final int fromVersion, final int toVersion) throws AMQStoreException
+ void upgrade(final int fromVersion, final int toVersion)
{
try
{
@@ -152,27 +150,27 @@ public class Upgrader
}
catch (ClassNotFoundException e)
{
- throw new AMQStoreException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ throw new ServerScopedRuntimeException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ toVersion, e);
}
catch (NoSuchMethodException e)
{
- throw new AMQStoreException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ throw new ServerScopedRuntimeException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ toVersion, e);
}
catch (InvocationTargetException e)
{
- throw new AMQStoreException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ throw new ServerScopedRuntimeException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ toVersion, e);
}
catch (InstantiationException e)
{
- throw new AMQStoreException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ throw new ServerScopedRuntimeException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ toVersion, e);
}
catch (IllegalAccessException e)
{
- throw new AMQStoreException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ throw new ServerScopedRuntimeException("Unable to upgrade BDB data store from version " + fromVersion + " to version"
+ toVersion, e);
}
}
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java
index 3f32df4b0c..7f7b65f315 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/HAMessageStoreSmokeTest.java
@@ -21,6 +21,7 @@ package org.apache.qpid.server.store.berkeleydb;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.qpid.server.model.VirtualHost;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.test.utils.QpidTestCase;
import static org.mockito.Mockito.mock;
@@ -36,7 +37,7 @@ public class HAMessageStoreSmokeTest extends QpidTestCase
_store.configure(mock(VirtualHost.class));
fail("Expected an exception to be thrown");
}
- catch (ConfigurationException ce)
+ catch (ServerScopedRuntimeException ce)
{
assertTrue(ce.getMessage().contains("BDB HA configuration key not found"));
}
diff --git a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgraderFailOnNewerVersionTest.java b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgraderFailOnNewerVersionTest.java
index 75717120b3..400ac12792 100644
--- a/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgraderFailOnNewerVersionTest.java
+++ b/qpid/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/upgrade/UpgraderFailOnNewerVersionTest.java
@@ -21,21 +21,13 @@
package org.apache.qpid.server.store.berkeleydb.upgrade;
import com.sleepycat.bind.tuple.IntegerBinding;
-import com.sleepycat.bind.tuple.LongBinding;
import com.sleepycat.je.Cursor;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseConfig;
import com.sleepycat.je.DatabaseEntry;
-import com.sleepycat.je.Environment;
-import com.sleepycat.je.EnvironmentConfig;
import com.sleepycat.je.OperationStatus;
-import com.sleepycat.je.Transaction;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.qpid.AMQStoreException;
import org.apache.qpid.server.store.berkeleydb.AbstractBDBMessageStore;
-import org.apache.qpid.server.store.berkeleydb.tuple.ContentBinding;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class UpgraderFailOnNewerVersionTest extends AbstractUpgradeTestCase
{
@@ -99,7 +91,7 @@ public class UpgraderFailOnNewerVersionTest extends AbstractUpgradeTestCase
_upgrader.upgradeIfNecessary();
fail("Store should not be able to be upgraded");
}
- catch(AMQStoreException ex)
+ catch(ServerScopedRuntimeException ex)
{
assertEquals("Incorrect exception thrown", "Database version 999 is higher than the most recent known version: "
+ AbstractBDBMessageStore.VERSION, ex.getMessage());