[jboss-jira] [JBoss JIRA] (WFWIP-131) SmallRye Metrics - MetricsRegistryImpl - removal of entry from map which is currently iterated

Jeff Mesnil (Jira) issues at jboss.org
Mon Nov 5 07:45:00 EST 2018


    [ https://issues.jboss.org/browse/WFWIP-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13656529#comment-13656529 ] 

Jeff Mesnil commented on WFWIP-131:
-----------------------------------

+1, I'll work on an upstream patch

> SmallRye Metrics - MetricsRegistryImpl - removal of entry from map which is currently iterated
> ----------------------------------------------------------------------------------------------
>
>                 Key: WFWIP-131
>                 URL: https://issues.jboss.org/browse/WFWIP-131
>             Project: WildFly WIP
>          Issue Type: Bug
>          Components: MP Metrics
>            Reporter: Rostislav Svoboda
>            Assignee: Jeff Mesnil
>            Priority: Major
>
> SmallRye Metrics - MetricsRegistryImpl - removal of entry from map which is currently iterated
> https://github.com/smallrye/smallrye-metrics/blob/master/implementation/src/main/java/io/smallrye/metrics/MetricsRegistryImpl.java#L266
> Method {{removeMatching}} is iterating over {{metricMap}}. If there is a match {{remove}} method is called. This method removes entry from {{metricMap}} and from {{metadataMap}}.
> I don't like the fact that the entry is removed from the map by external method while the map is currently iterated by the {{removeMatching}} method.
> I think https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html#remove-- should be called in {{removeMatching}} for {{metricMap}} entry + invocation of metadataMap.remove(entry.getKey()) + log mesasge;



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list