Author: aidanskinner
Date: 2008-10-13 08:47:51 -0400 (Mon, 13 Oct 2008)
New Revision: 2624
Modified:
store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
Log:
Always close the cursor
Up timeout to 15000 microseconds
Always set ReadComitted mode.
Modified:
store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
===================================================================
---
store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java 2008-10-11
21:32:40 UTC (rev 2623)
+++
store/branches/java/broker-queue-refactor/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java 2008-10-13
12:47:51 UTC (rev 2624)
@@ -339,6 +339,11 @@
envConfig.setAllowCreate(false);
envConfig.setTransactional(true);
envConfig.setConfigParam("je.lock.nLockTables", "7");
+ envConfig.setLockTimeout(15000);
+
+ // Set transaction mode
+ _transactionConfig.setReadCommitted(true);
+
//This prevents background threads running which will potentially update the
store.
envConfig.setReadOnly(readonly);
try
@@ -358,7 +363,6 @@
_environment.close();
}
_environment = new Environment(environmentPath, envConfig);
- _transactionConfig.setReadCommitted(true);
return true;
}
@@ -988,11 +992,12 @@
{
_log.debug("Message Id: " + messageId + " Dequeue");
}
-
+
+ Cursor cursor = null;
try
{
- Cursor cursor = _deliveryDb.openCursor(tx, null);
+ cursor = _deliveryDb.openCursor(tx, null);
DatabaseEntry data = new DatabaseEntry();
OperationStatus status = cursor.getSearchKey(key, data, null);
if (status == OperationStatus.NOTFOUND)
@@ -1000,7 +1005,6 @@
throw new AMQException("Unable to find message with id " +
messageId + " on queue " + name);
}
status = cursor.delete();
- cursor.close();
if (status != OperationStatus.SUCCESS)
{
throw new AMQException("Unable to remove message with id " +
messageId + " on queue " + name);
@@ -1038,6 +1042,20 @@
throw new AMQException("Error accessing database while dequeuing
message: " + e, e);
}
+ finally
+ {
+ if (cursor != null)
+ {
+ try
+ {
+ cursor.close();
+ }
+ catch (DatabaseException e)
+ {
+ throw new AMQException("Error closing cursor while dequeuing
message: " + e, e);
+ }
+ }
+ }
}
private boolean isLocalTransaction(StoreContext context)
Show replies by date