[hornetq-commits] JBoss hornetq SVN: r7961 - trunk/src/main/org/hornetq/core/server/impl.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Sep 16 08:31:31 EDT 2009
Author: jmesnil
Date: 2009-09-16 08:31:31 -0400 (Wed, 16 Sep 2009)
New Revision: 7961
Modified:
trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
Log:
HORNETQ-26: Why does QueueImpl::changeMessagePriority delete the ref?
* do not delete the ref. Instead, removed the ref from the messageReferences,
change its prioriity and add it back.
Modified: trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java 2009-09-16 03:05:20 UTC (rev 7960)
+++ trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java 2009-09-16 12:31:31 UTC (rev 7961)
@@ -983,23 +983,20 @@
public synchronized boolean changeReferencePriority(final long messageID, final byte newPriority) throws Exception
{
- List<MessageReference> refs = list(null);
- for (MessageReference ref : refs)
+ Iterator<MessageReference> iter = messageReferences.iterator();
+
+ while (iter.hasNext())
{
- ServerMessage message = ref.getMessage();
- if (message.getMessageID() == messageID)
+ MessageReference ref = iter.next();
+ if (ref.getMessage().getMessageID() == messageID)
{
- message.setPriority(newPriority);
- // delete and add the reference so that it
- // goes to the right queues for the new priority
-
- // FIXME - why deleting the reference?? This will delete it from storage!!
-
- deleteReference(messageID);
+ iter.remove();
+ ref.getMessage().setPriority(newPriority);
addLast(ref);
return true;
}
}
+
return false;
}
More information about the hornetq-commits
mailing list