https://issues.apache.org/jira/browse/AMQ-3379 - unique property eviction strategy - remove oldest if there's no duplicates

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1140665 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2011-06-28 14:56:41 +00:00
parent f7988655d3
commit 007bd4cc56
1 changed files with 6 additions and 3 deletions

View File

@ -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 UniquePropertyMessageEvictionStrategy extends MessageEvictionStrate
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()};
}
}