activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1140665 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/UniquePropertyMessageEvictionStrategy.java
Date Tue, 28 Jun 2011 14:56:41 GMT
Author: dejanb
Date: Tue Jun 28 14:56:41 2011
New Revision: 1140665

URL: http://svn.apache.org/viewvc?rev=1140665&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3379 - unique property eviction strategy - remove
oldest if there's no duplicates

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/UniquePropertyMessageEvictionStrategy.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/UniquePropertyMessageEvictionStrategy.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/UniquePropertyMessageEvictionStrategy.java?rev=1140665&r1=1140664&r2=1140665&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/UniquePropertyMessageEvictionStrategy.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/policy/UniquePropertyMessageEvictionStrategy.java
Tue Jun 28 14:56:41 2011
@@ -28,6 +28,7 @@ import java.util.LinkedList;
 /**
  * An eviction strategy which evicts the oldest message with the lowest priority first.
  *
+ *
  * @org.apache.xbean.XBean
  *
  * messageEvictionStrategy
@@ -68,10 +69,12 @@ public class UniquePropertyMessageEvicti
             for (MessageReference ref : pivots.values()) {
                 messages.remove(ref);
             }
-            return (MessageReference[])messages.toArray(new MessageReference[messages.size()]);
-        } else {
-            return new MessageReference[] {(MessageReference) messages.removeFirst()};
+            if (messages.size() != 0) {
+                return (MessageReference[])messages.toArray(new MessageReference[messages.size()]);
+            }
         }
 
+        return new MessageReference[] {(MessageReference) messages.removeFirst()};
+
     }
 }



Mime
View raw message