brusdev commented on code in PR #4120:
URL: https://github.com/apache/activemq-artemis/pull/4120#discussion_r906065299
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java:
##########
@@ -2018,7 +2018,20 @@ public void incrementMesssagesAdded() {
@Override
public void deliverScheduledMessages() throws ActiveMQException {
- List<MessageReference> scheduledMessages =
scheduledDeliveryHandler.cancel(null);
+ internalDeliverScheduleMessages(scheduledDeliveryHandler.cancel(ref ->
true));
+ }
+
+ @Override
+ public void deliverScheduledMessages(String filterString) throws
ActiveMQException {
+ internalDeliverScheduleMessages(scheduledDeliveryHandler.cancel(ref ->
filterString == null || filterString.length() == 0 ? true :
FilterImpl.createFilter(filterString).match(ref.getMessage())));
Review Comment:
The performance could be improved creating the filter only one time before
creating the comparator
```suggestion
final Filter filter = filterString == null || filterString.length() ==
0 ? null : FilterImpl.createFilter(filterString);
internalDeliverScheduleMessages(scheduledDeliveryHandler.cancel(ref ->
filter == null ? true : filter.match(ref.getMessage())));
```
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerImpl.java:
##########
@@ -135,6 +134,10 @@ public List<MessageReference> cancel(final Filter filter)
throws ActiveMQExcepti
return refs;
}
+ public interface CancelComparator {
+ boolean compare(MessageReference ref) throws ActiveMQException;
Review Comment:
The ActiveMQException isn't required if the the filter is created before
calling the comparator and the CancelComparator could be replaced by
java.util.function.Predicate<MessageReference>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]