[
https://issues.apache.org/jira/browse/ARTEMIS-3872?focusedWorklogId=784601&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-784601
]
ASF GitHub Bot logged work on ARTEMIS-3872:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 24/Jun/22 13:34
Start Date: 24/Jun/22 13:34
Worklog Time Spent: 10m
Work Description: 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>
Issue Time Tracking
-------------------
Worklog Id: (was: 784601)
Remaining Estimate: 0h
Time Spent: 10m
> Send scheduled message immediately via mangement
> ------------------------------------------------
>
> Key: ARTEMIS-3872
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3872
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Reporter: Justin Bertram
> Assignee: Justin Bertram
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.20.7#820007)