Author: rgemmell
Date: 2010-07-26 11:58:14 -0400 (Mon, 26 Jul 2010)
New Revision: 4147
Modified:
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/DatabaseVisitor.java
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java
store/trunk/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
store/trunk/java/bdbstore/test-profiles/java-bdb.0.10.testprofile
Log:
Update BDB store to throw AMQStoreException instead of AMQException, fix compilation due
to changes to main codebase. Applied patch from Andrew Kennedy
Modified:
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java
===================================================================
---
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java 2010-07-26
13:39:22 UTC (rev 4146)
+++
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBBackup.java 2010-07-26
15:58:14 UTC (rev 4147)
@@ -29,7 +29,6 @@
import org.apache.qpid.util.CommandLineParser;
import org.apache.qpid.util.FileUtils;
-import org.apache.qpid.util.PrettyPrintingUtils;
import java.io.*;
import java.util.LinkedList;
@@ -127,8 +126,7 @@
if (log.isInfoEnabled())
{
- log.info("BDBBackup Utility: Hot Backup Completed. Files backed up:
"
- + PrettyPrintingUtils.printArray(backedUpFiles));
+ log.info("BDBBackup Utility: Hot Backup Completed. Files backed up:
" + backedUpFiles);
}
}
catch (Exception e)
Modified:
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
===================================================================
---
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java 2010-07-26
13:39:22 UTC (rev 4146)
+++
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java 2010-07-26
15:58:14 UTC (rev 4147)
@@ -34,7 +34,7 @@
import org.apache.commons.configuration.Configuration;
import org.apache.log4j.Logger;
-import org.apache.qpid.AMQException;
+import org.apache.qpid.AMQStoreException;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.framing.FieldTable;
import org.apache.qpid.server.exchange.Exchange;
@@ -45,6 +45,7 @@
import org.apache.qpid.server.logging.messages.TransactionLogMessages;
import org.apache.qpid.server.queue.AMQQueue;
import org.apache.qpid.server.store.ConfigurationRecoveryHandler;
+import org.apache.qpid.server.store.DurableConfigurationStore;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.MessageStoreRecoveryHandler;
import org.apache.qpid.server.store.StorableMessageMetaData;
@@ -90,7 +91,7 @@
* exchanges. <tr><td> Store and remove messages. <tr><td> Bind
and unbind queues to exchanges. <tr><td> Enqueue and
* dequeue messages to queues. <tr><td> Generate message identifiers.
</table>
*/
-@SuppressWarnings({"unchecked","deprecation"})
+@SuppressWarnings({"unchecked"})
public class BDBMessageStore implements MessageStore
{
private static final Logger _log = Logger.getLogger(BDBMessageStore.class);
@@ -284,16 +285,14 @@
return configure(environmentPath, false);
}
-
/**
- *
* @param environmentPath location for the store to be created in/recovered from
* @param readonly if true then don't allow modifications to an existing store,
and don't create a new store if none exists
* @return whether or not a new store environment was created
- * @throws AMQException
+ * @throws AMQStoreException
* @throws DatabaseException
*/
- protected boolean configure(File environmentPath, boolean readonly) throws
AMQException, DatabaseException
+ protected boolean configure(File environmentPath, boolean readonly) throws
AMQStoreException, DatabaseException
{
stateTransition(State.INITIAL, State.CONFIGURING);
@@ -318,14 +317,14 @@
*
* This is required if you do not want to perform recovery of the store data
*
- * @throws AMQException if the store is not in the correct state
+ * @throws AMQStoreException if the store is not in the correct state
*/
- public void start() throws AMQException
+ public void start() throws AMQStoreException
{
stateTransition(State.CONFIGURING, State.STARTED);
}
- private boolean setupStore(File storePath, boolean readonly) throws
DatabaseException, AMQException
+ private boolean setupStore(File storePath, boolean readonly) throws
DatabaseException, AMQStoreException
{
checkState(State.CONFIGURING);
@@ -364,8 +363,8 @@
continue;
}
}
- // Otherwise Check Versions
+ // Otherwise Check Versions
int version = Integer.parseInt(s.substring(versionIndex + 2));
if (version != _version)
@@ -377,22 +376,22 @@
}
}
- private synchronized void stateTransition(State requiredState, State newState) throws
AMQException
+ private synchronized void stateTransition(State requiredState, State newState) throws
AMQStoreException
{
if (_state != requiredState)
{
- throw new AMQException("Cannot transition to the state: " +
newState + "; need to be in state: " + requiredState
+ throw new AMQStoreException("Cannot transition to the state: " +
newState + "; need to be in state: " + requiredState
+ "; currently in state: " + _state);
}
_state = newState;
}
- private void checkState(State requiredState) throws AMQException
+ private void checkState(State requiredState) throws AMQStoreException
{
if (_state != requiredState)
{
- throw new AMQException("Unexpected state: " + _state + ";
required state: " + requiredState);
+ throw new AMQStoreException("Unexpected state: " + _state + ";
required state: " + requiredState);
}
}
@@ -539,7 +538,7 @@
}
- public void recover(ConfigurationRecoveryHandler recoveryHandler) throws
AMQException
+ public void recover(ConfigurationRecoveryHandler recoveryHandler) throws
AMQStoreException
{
stateTransition(State.CONFIGURED, State.RECOVERING);
@@ -560,7 +559,7 @@
}
catch (DatabaseException e)
{
- throw new AMQException("Error recovering persistent state: " + e,
e);
+ throw new AMQStoreException("Error recovering persistent state: " +
e.getMessage(), e);
}
}
@@ -601,7 +600,7 @@
}
- private void loadExchanges(ExchangeRecoveryHandler erh) throws AMQException,
DatabaseException
+ private void loadExchanges(ExchangeRecoveryHandler erh) throws DatabaseException
{
Cursor cursor = null;
@@ -704,7 +703,7 @@
}
catch (DatabaseException e)
{
- _log.error("Database Error: " + e, e);
+ _log.error("Database Error: " + e.getMessage(), e);
throw e;
}
finally
@@ -717,7 +716,7 @@
}
private void recoverQueueEntries(TransactionLogRecoveryHandler recoveryHandler)
- throws DatabaseException, AMQException
+ throws DatabaseException
{
QueueEntryRecoveryHandler qerh = recoveryHandler.begin(this);
@@ -758,7 +757,7 @@
}
catch (DatabaseException e)
{
- _log.error("Database Error: " + e, e);
+ _log.error("Database Error: " + e.getMessage(), e);
throw e;
}
finally
@@ -777,10 +776,9 @@
*
* @param messageId Identifies the message to remove.
*
- * @throws AMQException If the operation fails for any reason.
- * @throws DatabaseException
+ * @throws AMQInternalException If the operation fails for any reason.
*/
- public void removeMessage(Long messageId) throws AMQException
+ public void removeMessage(Long messageId) throws AMQStoreException
{
// _log.debug("public void removeMessage(StoreContext context = " +
context + ", Long messageId = " + messageId
// + "): called");
@@ -808,7 +806,7 @@
{
tx.abort();
- throw new AMQException("Message metadata not found for message id
" + messageId);
+ throw new AMQStoreException("Message metadata not found for message
id " + messageId);
}
if (_log.isDebugEnabled())
@@ -851,7 +849,7 @@
cursor = null;
tx.abort();
- throw new AMQException("Content chunk offset" +
mck.getOffset() + " not found for message " + messageId);
+ throw new AMQStoreException("Content chunk offset" +
mck.getOffset() + " not found for message " + messageId);
}
if (_log.isDebugEnabled())
@@ -886,11 +884,11 @@
}
catch (DatabaseException e1)
{
- throw new AMQException("Error aborting transaction " + e1,
e1);
+ throw new AMQStoreException("Error aborting transaction " +
e1, e1);
}
}
- throw new AMQException("Error removing message with id " +
messageId + " from database: " + e, e);
+ throw new AMQStoreException("Error removing message with id " +
messageId + " from database: " + e.getMessage(), e);
}
finally
{
@@ -902,21 +900,16 @@
}
catch (DatabaseException e)
{
- //TODO
- throw new RuntimeException(e);
+ throw new AMQStoreException("Error closing database connection:
" + e.getMessage(), e);
}
}
}
}
/**
- * Makes the specified exchange persistent.
- *
- * @param exchange The exchange to persist.
- *
- * @throws AMQException If the operation fails for any reason.
+ * @see DurableConfigurationStore#createExchange(Exchange)
*/
- public void createExchange(Exchange exchange) throws AMQException
+ public void createExchange(Exchange exchange) throws AMQStoreException
{
if (_state != State.RECOVERING)
{
@@ -937,20 +930,15 @@
}
catch (DatabaseException e)
{
- throw new AMQException("Error writing Exchange with name " +
exchange.getName() + " to database: " + e, e);
+ throw new AMQStoreException("Error writing Exchange with name "
+ exchange.getName() + " to database: " + e.getMessage(), e);
}
}
}
/**
- * Removes the specified persistent exchange.
- * Internal method that is package scoped to allow testing.
- *
- * @param exchange The exchange to remove.
- *
- * @throws org.apache.qpid.AMQException If the operation fails for any reason.
+ * @see DurableConfigurationStore#removeExchange(Exchange)
*/
- public void removeExchange(Exchange exchange) throws AMQException
+ public void removeExchange(Exchange exchange) throws AMQStoreException
{
DatabaseEntry key = new DatabaseEntry();
EntryBinding keyBinding = new AMQShortStringTB();
@@ -960,12 +948,12 @@
OperationStatus status = _exchangeDb.delete(null, key);
if (status == OperationStatus.NOTFOUND)
{
- throw new AMQException("Exchange " + exchange.getName() +
" not found");
+ throw new AMQStoreException("Exchange " + exchange.getName() +
" not found");
}
}
catch (DatabaseException e)
{
- throw new AMQException("Error writing deleting with name " +
exchange.getName() + " from database: " + e, e);
+ throw new AMQStoreException("Error writing deleting with name " +
exchange.getName() + " from database: " + e.getMessage(), e);
}
}
@@ -973,16 +961,9 @@
/**
- * Binds the specified queue to an exchange with a routing key.
- *
- * @param exchange The exchange to bind to.
- * @param routingKey The routing key to bind by.
- * @param queue The queue to bind.
- * @param args Additional parameters.
- *
- * @throws AMQException If the operation fails for any reason.
+ * @see DurableConfigurationStore#bindQueue(Exchange, AMQShortString, AMQQueue,
FieldTable)
*/
- public void bindQueue(Exchange exchange, AMQShortString routingKey, AMQQueue queue,
FieldTable args) throws AMQException
+ public void bindQueue(Exchange exchange, AMQShortString routingKey, AMQQueue queue,
FieldTable args) throws AMQStoreException
{
// _log.debug("public void bindQueue(Exchange exchange = " + exchange +
", AMQShortString routingKey = " + routingKey
// + ", AMQQueue queue = " + queue + ", FieldTable args = " +
args + "): called");
@@ -1009,24 +990,17 @@
}
catch (DatabaseException e)
{
- throw new AMQException("Error writing binding for AMQQueue with name
" + queue.getName() + " to exchange "
- + exchange.getName() + " to database: "
+ e, e);
+ throw new AMQStoreException("Error writing binding for AMQQueue with
name " + queue.getName() + " to exchange "
+ + exchange.getName() + " to database: "
+ e.getMessage(), e);
}
}
}
/**
- * Unbinds the specified from an exchange under a particular routing key.
- *
- * @param exchange The exchange to unbind from.
- * @param routingKey The routing key to unbind.
- * @param queue The queue to unbind.
- * @param args Additonal parameters.
- *
- * @throws AMQException If the operation fails for any reason.
+ * @see DurableConfigurationStore#unbindQueue(Exchange, AMQShortString, AMQQueue,
FieldTable)
*/
public void unbindQueue(Exchange exchange, AMQShortString routingKey, AMQQueue queue,
FieldTable args)
- throws AMQException
+ throws AMQStoreException
{
DatabaseEntry key = new DatabaseEntry();
EntryBinding keyBinding = _bindingTupleBindingFactory.getInstance();
@@ -1037,31 +1011,29 @@
OperationStatus status = _queueBindingsDb.delete(null, key);
if (status == OperationStatus.NOTFOUND)
{
- throw new AMQException("Queue binding for queue with name " +
queue.getName() + " to exchange "
+ throw new AMQStoreException("Queue binding for queue with name
" + queue.getName() + " to exchange "
+ exchange.getName() + " not found");
}
}
catch (DatabaseException e)
{
- throw new AMQException("Error deleting queue binding for queue with name
" + queue.getName() + " to exchange "
- + exchange.getName() + " from database: " +
e, e);
+ throw new AMQStoreException("Error deleting queue binding for queue with
name " + queue.getName() + " to exchange "
+ + exchange.getName() + " from database: " +
e.getMessage(), e);
}
}
- public void createQueue(AMQQueue queue) throws AMQException
+ /**
+ * @see DurableConfigurationStore#createQueue(AMQQueue)
+ */
+ public void createQueue(AMQQueue queue) throws AMQStoreException
{
createQueue(queue, null);
}
/**
- * Makes the specified queue persistent.
- *
- * @param queue The queue to store.
- * @param arguments
- *
- * @throws AMQException If the operation fails for any reason.
+ * @see DurableConfigurationStore#createQueue(AMQQueue, FieldTable)
*/
- public void createQueue(AMQQueue queue, FieldTable arguments) throws AMQException
+ public void createQueue(AMQQueue queue, FieldTable arguments) throws
AMQStoreException
{
if (_log.isDebugEnabled())
{
@@ -1081,9 +1053,9 @@
*
* @param queueRecord Details of the queue to store.
*
- * @throws AMQException If the operation fails for any reason.
+ * @throws AMQStoreException If the operation fails for any reason.
*/
- protected void createQueue(QueueRecord queueRecord) throws AMQException
+ protected void createQueue(QueueRecord queueRecord) throws AMQStoreException
{
if (_state != State.RECOVERING)
{
@@ -1101,8 +1073,8 @@
}
catch (DatabaseException e)
{
- throw new AMQException("Error writing AMQQueue with name " +
- queueRecord.getNameShortString().toString() + " to database:
" + e, e);
+ throw new AMQStoreException("Error writing AMQQueue with name "
+ queueRecord.getNameShortString().asString()
+ + " to database: " + e.getMessage(), e);
}
}
}
@@ -1114,9 +1086,9 @@
* NOTE: Currently only updates the exclusivity.
*
* @param queue The queue to update the entry for.
- * @throws org.apache.qpid.AMQException If the operation fails for any reason.
+ * @throws AMQStoreException If the operation fails for any reason.
*/
- public void updateQueue(final AMQQueue queue) throws AMQException
+ public void updateQueue(final AMQQueue queue) throws AMQStoreException
{
if (_log.isDebugEnabled())
{
@@ -1147,12 +1119,12 @@
}
else if(status != OperationStatus.NOTFOUND)
{
- throw new AMQException("Error updating queue details within the
store: " + status);
+ throw new AMQStoreException("Error updating queue details within the
store: " + status);
}
}
catch (DatabaseException e)
{
- throw new AMQException("Error updating queue details within the store:
" + e,e);
+ throw new AMQStoreException("Error updating queue details within the
store: " + e,e);
}
}
@@ -1161,9 +1133,9 @@
*
* @param queue The queue to remove.
*
- * @throws AMQException If the operation fails for any reason.
+ * @throws AMQStoreException If the operation fails for any reason.
*/
- public void removeQueue(final AMQQueue queue) throws AMQException
+ public void removeQueue(final AMQQueue queue) throws AMQStoreException
{
AMQShortString name = queue.getNameShortString();
@@ -1180,12 +1152,12 @@
OperationStatus status = _queueDb.delete(null, key);
if (status == OperationStatus.NOTFOUND)
{
- throw new AMQException("Queue " + name + " not
found");
+ throw new AMQStoreException("Queue " + name + " not
found");
}
}
catch (DatabaseException e)
{
- throw new AMQException("Error writing deleting with name " + name +
" from database: " + e, e);
+ throw new AMQStoreException("Error writing deleting with name " +
name + " from database: " + e.getMessage(), e);
}
}
@@ -1196,9 +1168,9 @@
* @param queue The the queue to place the message on.
* @param messageId The message to enqueue.
*
- * @throws AMQException If the operation fails for any reason.
+ * @throws AMQStoreException If the operation fails for any reason.
*/
- public void enqueueMessage(StoreContext context, final TransactionLogResource queue,
Long messageId) throws AMQException
+ public void enqueueMessage(StoreContext context, final TransactionLogResource queue,
Long messageId) throws AMQStoreException
{
// _log.debug("public void enqueueMessage(StoreContext context = " +
context + ", AMQShortString name = " + name
// + ", Long messageId): called");
@@ -1223,8 +1195,8 @@
}
catch (DatabaseException e)
{
- _log.error("Failed to enqueue: " + e, e);
- throw new AMQException("Error writing enqueued message with id " +
messageId + " for queue " + name
+ _log.error("Failed to enqueue: " + e.getMessage(), e);
+ throw new AMQStoreException("Error writing enqueued message with id
" + messageId + " for queue " + name
+ " to database", e);
}
}
@@ -1236,9 +1208,9 @@
* @param queue The name queue to take the message from.
* @param messageId The message to dequeue.
*
- * @throws AMQException If the operation fails for any reason, or if the specified
message does not exist.
+ * @throws AMQStoreException If the operation fails for any reason, or if the
specified message does not exist.
*/
- public void dequeueMessage(StoreContext context, final TransactionLogResource queue,
Long messageId) throws AMQException
+ public void dequeueMessage(StoreContext context, final TransactionLogResource queue,
Long messageId) throws AMQStoreException
{
AMQShortString name = new AMQShortString(queue.getResourceName());
@@ -1261,11 +1233,11 @@
OperationStatus status = _deliveryDb.delete(tx, key);
if (status == OperationStatus.NOTFOUND)
{
- throw new AMQException("Unable to find message with id " +
messageId + " on queue " + name);
+ throw new AMQStoreException("Unable to find message with id " +
messageId + " on queue " + name);
}
else if (status != OperationStatus.SUCCESS)
{
- throw new AMQException("Unable to remove message with id " +
messageId + " on queue " + name);
+ throw new AMQStoreException("Unable to remove message with id "
+ messageId + " on queue " + name);
}
if (_log.isDebugEnabled())
@@ -1277,10 +1249,10 @@
catch (DatabaseException e)
{
- _log.error("Failed to dequeue message " + messageId + ":
" + e, e);
+ _log.error("Failed to dequeue message " + messageId + ":
" + e.getMessage(), e);
_log.error(tx);
- throw new AMQException("Error accessing database while dequeuing
message: " + e, e);
+ throw new AMQStoreException("Error accessing database while dequeuing
message: " + e.getMessage(), e);
}
}
@@ -1289,9 +1261,9 @@
*
* @param context The transactional context to commit all operations for.
*
- * @throws AMQException If the operation fails for any reason.
+ * @throws AMQStoreException If the operation fails for any reason.
*/
- private StoreFuture commitTranImpl(StoreContext context, boolean syncCommit) throws
AMQException
+ private StoreFuture commitTranImpl(StoreContext context, boolean syncCommit) throws
AMQStoreException
{
com.sleepycat.je.Transaction tx = (com.sleepycat.je.Transaction)
context.getPayload();
@@ -1302,7 +1274,7 @@
if (tx == null)
{
- throw new AMQException("Fatal internal error: transactional context is
empty at commitTran");
+ throw new AMQStoreException("Fatal internal error: transactional context
is empty at commitTran");
}
StoreFuture result;
@@ -1317,7 +1289,7 @@
}
catch (DatabaseException e)
{
- throw new AMQException("Error commit tx: " + e, e);
+ throw new AMQStoreException("Error commit tx: " + e.getMessage(),
e);
}
finally
{
@@ -1332,9 +1304,9 @@
*
* @param context The transactional context to abandon.
*
- * @throws AMQException If the operation fails for any reason.
+ * @throws AMQStoreException If the operation fails for any reason.
*/
- public void abortTran(StoreContext context) throws AMQException
+ public void abortTran(StoreContext context) throws AMQStoreException
{
com.sleepycat.je.Transaction tx = (com.sleepycat.je.Transaction)
context.getPayload();
@@ -1349,7 +1321,7 @@
}
catch (DatabaseException e)
{
- throw new AMQException("Error aborting transaction: " + e, e);
+ throw new AMQStoreException("Error aborting transaction: " +
e.getMessage(), e);
}
finally
{
@@ -1364,7 +1336,7 @@
*
* @return a list of message ids for messages enqueued for a particular queue
*/
- List<Long> getEnqueuedMessages(AMQShortString queueName) throws AMQException
+ List<Long> getEnqueuedMessages(AMQShortString queueName) throws
AMQStoreException
{
Cursor cursor = null;
try
@@ -1400,7 +1372,7 @@
}
catch (DatabaseException e)
{
- throw new AMQException("Database error: " + e, e);
+ throw new AMQStoreException("Database error: " + e.getMessage(),
e);
}
finally
{
@@ -1412,7 +1384,7 @@
}
catch (DatabaseException e)
{
- throw new AMQException("Error closing cursor: " + e, e);
+ throw new AMQStoreException("Error closing cursor: " +
e.getMessage(), e);
}
}
}
@@ -1436,10 +1408,10 @@
* @param offset The offset of the data chunk in the message.
* @param contentBody The content of the data chunk.
*
- * @throws AMQException If the operation fails for any reason, or if the specified
message does not exist.
+ * @throws AMQStoreException If the operation fails for any reason, or if the
specified message does not exist.
*/
protected void addContent(StoreContext context, Long messageId, int offset,
- ByteBuffer contentBody) throws AMQException
+ ByteBuffer contentBody) throws AMQStoreException
{
com.sleepycat.je.Transaction tx = (com.sleepycat.je.Transaction)
context.getPayload();
@@ -1455,7 +1427,7 @@
OperationStatus status = _messageContentDb.put(tx, key, value);
if (status != OperationStatus.SUCCESS)
{
- throw new AMQException("Error adding content chunk offset" +
offset + " for message id " + messageId + ": "
+ throw new AMQStoreException("Error adding content chunk offset"
+ offset + " for message id " + messageId + ": "
+ status);
}
@@ -1466,7 +1438,7 @@
}
catch (DatabaseException e)
{
- throw new AMQException("Error writing AMQMessage with id " +
messageId + " to database: " + e, e);
+ throw new AMQStoreException("Error writing AMQMessage with id " +
messageId + " to database: " + e.getMessage(), e);
}
}
@@ -1477,10 +1449,10 @@
* @param messageId The message to store the data for.
* @param messageMetaData The message meta data to store.
*
- * @throws AMQException If the operation fails for any reason, or if the specified
message does not exist.
+ * @throws AMQStoreException If the operation fails for any reason, or if the
specified message does not exist.
*/
private void storeMetaData(StoreContext context, Long messageId,
StorableMessageMetaData messageMetaData)
- throws AMQException
+ throws AMQStoreException
{
if (_log.isDebugEnabled())
{
@@ -1507,7 +1479,7 @@
}
catch (DatabaseException e)
{
- throw new AMQException("Error writing message metadata with id " +
messageId + " to database: " + e, e);
+ throw new AMQStoreException("Error writing message metadata with id
" + messageId + " to database: " + e.getMessage(), e);
}
}
@@ -1518,9 +1490,9 @@
*
* @return The message meta data.
*
- * @throws AMQException If the operation fails for any reason, or if the specified
message does not exist.
+ * @throws AMQStoreException If the operation fails for any reason, or if the
specified message does not exist.
*/
- public StorableMessageMetaData getMessageMetaData(Long messageId) throws
AMQException
+ public StorableMessageMetaData getMessageMetaData(Long messageId) throws
AMQStoreException
{
if (_log.isDebugEnabled())
{
@@ -1539,7 +1511,7 @@
OperationStatus status = _messageMetaDataDb.get(null, key, value,
LockMode.READ_UNCOMMITTED);
if (status != OperationStatus.SUCCESS)
{
- throw new AMQException("Metadata not found for message with id
" + messageId);
+ throw new AMQStoreException("Metadata not found for message with id
" + messageId);
}
StorableMessageMetaData mdd = (StorableMessageMetaData)
messageBinding.entryToObject(value);
@@ -1548,8 +1520,7 @@
}
catch (DatabaseException e)
{
-
- throw new AMQException("Error reading message metadata for message with
id " + messageId + ": " + e, e);
+ throw new AMQStoreException("Error reading message metadata for message
with id " + messageId + ": " + e.getMessage(), e);
}
}
@@ -1563,9 +1534,9 @@
*
* @return The number of bytes inserted into the destination
*
- * @throws AMQException If the operation fails for any reason, or if the specified
message does not exist.
+ * @throws AMQStoreException If the operation fails for any reason, or if the
specified message does not exist.
*/
- public int getContent(Long messageId, int offset, ByteBuffer dst) throws
AMQException
+ public int getContent(Long messageId, int offset, ByteBuffer dst) throws
AMQStoreException
{
DatabaseEntry contentKeyEntry = new DatabaseEntry();
@@ -1634,8 +1605,7 @@
}
catch (DatabaseException e)
{
-
- throw new AMQException("Error writing AMQMessage with id " +
messageId + " to database: " + e, e);
+ throw new AMQStoreException("Error writing AMQMessage with id " +
messageId + " to database: " + e.getMessage(), e);
}
finally
{
@@ -1647,8 +1617,7 @@
}
catch (DatabaseException e)
{
- // TODO
- throw new RuntimeException(e);
+ throw new AMQStoreException("Error writing AMQMessage with id " +
messageId + " to database: " + e.getMessage(), e);
}
}
}
@@ -1721,32 +1690,32 @@
return _queueBindingsDb;
}
- void visitMetaDataDb(DatabaseVisitor visitor) throws DatabaseException, AMQException
+ void visitMetaDataDb(DatabaseVisitor visitor) throws DatabaseException,
AMQStoreException
{
visitDatabase(_messageMetaDataDb, visitor);
}
- void visitContentDb(DatabaseVisitor visitor) throws DatabaseException, AMQException
+ void visitContentDb(DatabaseVisitor visitor) throws DatabaseException,
AMQStoreException
{
visitDatabase(_messageContentDb, visitor);
}
- void visitQueues(DatabaseVisitor visitor) throws DatabaseException, AMQException
+ void visitQueues(DatabaseVisitor visitor) throws DatabaseException,
AMQStoreException
{
visitDatabase(_queueDb, visitor);
}
- void visitDelivery(DatabaseVisitor visitor) throws DatabaseException, AMQException
+ void visitDelivery(DatabaseVisitor visitor) throws DatabaseException,
AMQStoreException
{
visitDatabase(_deliveryDb, visitor);
}
- void visitExchanges(DatabaseVisitor visitor) throws DatabaseException, AMQException
+ void visitExchanges(DatabaseVisitor visitor) throws DatabaseException,
AMQStoreException
{
visitDatabase(_exchangeDb, visitor);
}
- void visitBindings(DatabaseVisitor visitor) throws DatabaseException, AMQException
+ void visitBindings(DatabaseVisitor visitor) throws DatabaseException,
AMQStoreException
{
visitDatabase(_queueBindingsDb, visitor);
}
@@ -1758,9 +1727,9 @@
* @param visitor The visitor to give each entry to.
*
* @throws DatabaseException If there is a problem with the Database structure
- * @throws AMQException If there is a programming error
+ * @throws AMQStoreException If there is a problem with the Database contents
*/
- void visitDatabase(Database database, DatabaseVisitor visitor) throws
DatabaseException, AMQException
+ void visitDatabase(Database database, DatabaseVisitor visitor) throws
DatabaseException, AMQStoreException
{
Cursor cursor = database.openCursor(null, null);
@@ -2036,7 +2005,7 @@
//TODO
throw new RuntimeException(e);
}
- catch (AMQException e)
+ catch (AMQStoreException e)
{
//TODO
throw new RuntimeException(e);
@@ -2053,7 +2022,7 @@
{
metaData = BDBMessageStore.this.getMessageMetaData(_messageId);
}
- catch (AMQException e)
+ catch (AMQStoreException e)
{
//TODO
throw new RuntimeException(e);
@@ -2075,7 +2044,7 @@
{
BDBMessageStore.this.addContent(_ctx, _messageId, offsetInMessage, src);
}
- catch (AMQException e)
+ catch (AMQStoreException e)
{
//TODO
throw new RuntimeException(e);
@@ -2088,7 +2057,7 @@
{
return BDBMessageStore.this.getContent(_messageId, offsetInMessage,
dst);
}
- catch (AMQException e)
+ catch (AMQStoreException e)
{
// TODO
throw new RuntimeException(e);
@@ -2108,7 +2077,7 @@
BDBMessageStore.this.commitTranImpl(_ctx, true);
}
}
- catch (AMQException e)
+ catch (AMQStoreException e)
{
//TODO
throw new RuntimeException(e);
@@ -2128,7 +2097,7 @@
{
BDBMessageStore.this.removeMessage(_messageId);
}
- catch (AMQException e)
+ catch (AMQStoreException e)
{
// TODO
throw new RuntimeException(e);
@@ -2156,28 +2125,28 @@
_ctx.setPayload(_txn);
}
- public void enqueueMessage(TransactionLogResource queue, Long messageId) throws
AMQException
+ public void enqueueMessage(TransactionLogResource queue, Long messageId) throws
AMQStoreException
{
BDBMessageStore.this.enqueueMessage(_ctx, queue, messageId);
}
- public void dequeueMessage(TransactionLogResource queue, Long messageId) throws
AMQException
+ public void dequeueMessage(TransactionLogResource queue, Long messageId) throws
AMQStoreException
{
BDBMessageStore.this.dequeueMessage(_ctx, queue, messageId);
}
- public void commitTran() throws AMQException
+ public void commitTran() throws AMQStoreException
{
BDBMessageStore.this.commitTranImpl(_ctx, true);
}
- public StoreFuture commitTranAsync() throws AMQException
+ public StoreFuture commitTranAsync() throws AMQStoreException
{
return BDBMessageStore.this.commitTranImpl(_ctx, false);
}
- public void abortTran() throws AMQException
+ public void abortTran() throws AMQStoreException
{
BDBMessageStore.this.abortTran(_ctx);
}
Modified:
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java
===================================================================
---
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java 2010-07-26
13:39:22 UTC (rev 4146)
+++
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBStoreUpgrade.java 2010-07-26
15:58:14 UTC (rev 4147)
@@ -40,6 +40,7 @@
import org.apache.qpid.server.logging.NullRootMessageLogger;
import org.apache.qpid.server.message.MessageMetaData;
import org.apache.qpid.AMQException;
+import org.apache.qpid.AMQStoreException;
import org.apache.qpid.util.FileUtils;
import org.apache.commons.cli.PosixParser;
import org.apache.commons.cli.Options;
@@ -451,7 +452,7 @@
DatabaseVisitor queueVisitor = new DatabaseVisitor()
{
- public void visit(DatabaseEntry key, DatabaseEntry value) throws
AMQException
+ public void visit(DatabaseEntry key, DatabaseEntry value) throws
AMQStoreException
{
QueueRecord queueRec = (QueueRecord)
queueTupleBinding.entryToObject(value);
AMQShortString queueName = queueRec.getNameShortString();
@@ -807,6 +808,7 @@
}
+ @SuppressWarnings("static-access")
private static void setOptions(Options options)
{
Option input =
Modified:
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/DatabaseVisitor.java
===================================================================
---
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/DatabaseVisitor.java 2010-07-26
13:39:22 UTC (rev 4146)
+++
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/DatabaseVisitor.java 2010-07-26
15:58:14 UTC (rev 4147)
@@ -20,16 +20,17 @@
*/
package org.apache.qpid.server.store.berkeleydb;
+import org.apache.qpid.AMQStoreException;
+
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.DatabaseException;
-import org.apache.qpid.AMQException;
/** Visitor Interface so that each DatabaseEntry for a database can easily be processed.
*/
public abstract class DatabaseVisitor
{
protected int _count;
- abstract public void visit(DatabaseEntry entry, DatabaseEntry value) throws
AMQException, DatabaseException;
+ abstract public void visit(DatabaseEntry entry, DatabaseEntry value) throws
AMQStoreException, DatabaseException;
public int getVisitedCount()
{
Modified:
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java
===================================================================
---
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java 2010-07-26
13:39:22 UTC (rev 4146)
+++
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/FieldTableEncoding.java 2010-07-26
15:58:14 UTC (rev 4147)
@@ -26,14 +26,7 @@
tupleInput.readFast(data);
ByteBuffer buffer = ByteBuffer.wrap(data);
- try
- {
- return new FieldTable(buffer,length);
- }
- catch (AMQFrameDecodingException e)
- {
- throw new DatabaseException(e);
- }
+ return new FieldTable(buffer,length);
}
Modified:
store/trunk/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java
===================================================================
---
store/trunk/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java 2010-07-26
13:39:22 UTC (rev 4146)
+++
store/trunk/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBUpgradeTest.java 2010-07-26
15:58:14 UTC (rev 4147)
@@ -331,4 +331,4 @@
{
new BDBStoreUpgrade(_fromDir, _toDir, null, false,
true).upgradeFromVersion(VERSION_2);
}
-}
\ No newline at end of file
+}
Modified: store/trunk/java/bdbstore/test-profiles/java-bdb.0.10.testprofile
===================================================================
--- store/trunk/java/bdbstore/test-profiles/java-bdb.0.10.testprofile 2010-07-26 13:39:22
UTC (rev 4146)
+++ store/trunk/java/bdbstore/test-profiles/java-bdb.0.10.testprofile 2010-07-26 15:58:14
UTC (rev 4147)
@@ -5,7 +5,7 @@
broker.ready=BRK-1004
broker.stopped=Exception
broker.config=${project.root}/build/etc/config-systests-bdb.xml
-profile.excludes=JavaStandaloneExcludes JavaPersistentExcludes CPPExcludes
CPPTransientExcludes
+profile.excludes=JavaStandaloneExcludes JavaPersistentExcludes Java010Excludes
08StandaloneExcludes
broker.clean.between.tests=true
broker.persistent=true