Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2398#discussion_r228619277 --- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java --- @@ -740,6 +733,56 @@ public String countMessages(final String filterStr, final String groupByProperty } } + @Override + public long countDeliveringMessages(final String filterStr) throws Exception { + Long value = intenalCountDeliveryMessages(filterStr, null).get(null); + return value == null ? 0 : value; + } + + @Override + public String countDeliveringMessages(final String filterStr, final String groupByProperty) throws Exception { + return JsonUtil.toJsonObject(intenalCountDeliveryMessages(filterStr, groupByProperty)).toString(); + } + + private Map<String, Long> intenalCountDeliveryMessages(final String filterStr, final String groupByPropertyStr) throws Exception { + checkStarted(); + + clearIO(); + + Map<String, Long> result = new HashMap<>(); + try { + Filter filter = FilterImpl.createFilter(filterStr); + SimpleString groupByProperty = SimpleString.toSimpleString(groupByPropertyStr); + if (filter == null && groupByProperty == null) { + result.put(null, Long.valueOf(getDeliveringCount())); + } else { + Map<String, List<MessageReference>> deliveringMessages = queue.getDeliveringMessages(); --- End diff -- getDeliveringMessages() doesn't return a thead safe reference, as such the list can change beneath. this will expose thread safety issues
---