mirror of https://github.com/apache/activemq.git
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:
parent
f7988655d3
commit
007bd4cc56
|
@ -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()};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue