activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1141033 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region: TopicSubscription.java policy/UniquePropertyMessageEvictionStrategy.java
Date Wed, 29 Jun 2011 10:11:25 GMT
Author: dejanb
Date: Wed Jun 29 10:11:25 2011
New Revision: 1141033

URL: http://svn.apache.org/viewvc?rev=1141033&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/TopicSubscription.java
    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/TopicSubscription.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java?rev=1141033&r1=1141032&r2=1141033&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/TopicSubscription.java
Wed Jun 29 10:11:25 2011
@@ -175,7 +175,7 @@ public class TopicSubscription extends A
                             // eviction strategy
                             // for a bad strategy lets just not evict
                             if (messagesToEvict == 0) {
-                                LOG.warn("No messages to evict returned from eviction strategy:
" + messageEvictionStrategy);
+                                LOG.warn("No messages to evict returned for "  + destination
+ " from eviction strategy: " + messageEvictionStrategy + " out of " + list.size() + " candidates");
                                 break;
                             }
                         }

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=1141033&r1=1141032&r2=1141033&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
Wed Jun 29 10:11:25 2011
@@ -17,6 +17,8 @@
 package org.apache.activemq.broker.region.policy;
 
 import org.apache.activemq.broker.region.MessageReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -35,6 +37,8 @@ import java.util.LinkedList;
  */
 public class UniquePropertyMessageEvictionStrategy extends MessageEvictionStrategySupport
{
 
+    private static final Logger LOG = LoggerFactory.getLogger(UniquePropertyMessageEvictionStrategy.class);
+
     protected String propertyName;
 
     public String getPropertyName() {
@@ -47,6 +51,7 @@ public class UniquePropertyMessageEvicti
 
     @Override
     public MessageReference[] evictMessages(LinkedList messages) throws IOException {
+        MessageReference oldest = (MessageReference)messages.getFirst();
         HashMap<Object, MessageReference> pivots = new HashMap<Object, MessageReference>();
         Iterator iter = messages.iterator();
 
@@ -69,12 +74,12 @@ public class UniquePropertyMessageEvicti
             for (MessageReference ref : pivots.values()) {
                 messages.remove(ref);
             }
+
             if (messages.size() != 0) {
                 return (MessageReference[])messages.toArray(new MessageReference[messages.size()]);
             }
         }
-
-        return new MessageReference[] {(MessageReference) messages.removeFirst()};
+        return new MessageReference[] {oldest};
 
     }
 }



Mime
View raw message