Author: ritchiem
Date: 2009-09-02 10:03:11 -0400 (Wed, 02 Sep 2009)
New Revision: 3613
Modified:
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
Log:
Update to Logging to ensure that recovered empty queues receive the required MST-1005 log
entry
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 2009-09-01
21:49:25 UTC (rev 3612)
+++
store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java 2009-09-02
14:03:11 UTC (rev 3613)
@@ -130,6 +130,8 @@
private QueueTupleBindingFactory _queueTupleBindingFactory;
private BindingTupleBindingFactory _bindingTupleBindingFactory;
+ Map<AMQShortString, Integer> _queueRecoveries = new TreeMap<AMQShortString,
Integer>();
+
/** The data version this store should run with */
private int _version;
private enum State
@@ -1240,6 +1242,8 @@
for (AMQQueue q : queues.values())
{
CurrentActor.get().message(_logSubject,MessageStoreMessages.MST_1004(String.valueOf(q.getName()),
true));
+ //Record that we have a queue for recovery
+ _queueRecoveries.put(q.getName(), 0);
q.configure(virtualHost.getConfiguration().getQueueConfiguration(q.getName().asString()));
@@ -1623,7 +1627,6 @@
Map<Long, AMQMessage> msgMap = new HashMap<Long, AMQMessage>();
List<ProcessAction> actions = new ArrayList<ProcessAction>();
- Map<AMQShortString, Integer> queueRecoveries = new
TreeMap<AMQShortString, Integer>();
Cursor cursor = null;
try
@@ -1674,13 +1677,13 @@
_log.debug("On recovery, delivering Message ID:" +
message.getMessageId() + " to " + queue.getName());
}
- Integer count = queueRecoveries.get(queueName);
+ Integer count = _queueRecoveries.get(queueName);
if (count == null)
{
count = 0;
}
- queueRecoveries.put(queueName, ++count);
+ _queueRecoveries.put(queueName, ++count);
actions.add(new ProcessAction(queue, context, message));
@@ -1713,15 +1716,18 @@
if (_log.isInfoEnabled())
{
- _log.info("Recovered message counts: " + queueRecoveries);
+ _log.info("Recovered message counts: " + _queueRecoveries);
}
- for(Map.Entry<AMQShortString,Integer> entry : queueRecoveries.entrySet())
+ for(Map.Entry<AMQShortString,Integer> entry : _queueRecoveries.entrySet())
{
CurrentActor.get().message(_logSubject,
MessageStoreMessages.MST_1005(entry.getValue(), String.valueOf(entry.getKey())));
CurrentActor.get().message(_logSubject,
MessageStoreMessages.MST_1006(String.valueOf(entry.getKey()), true));
}
+
+ //Free the memory
+ _queueRecoveries = null;
}
QueueRegistry getQueueRegistry()