You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Martin Styk (JIRA)" <ji...@apache.org> on 2016/10/03 07:29:20 UTC

[jira] [Resolved] (ARTEMIS-710) Avoid inefficient iteration over Map

     [ https://issues.apache.org/jira/browse/ARTEMIS-710?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Styk resolved ARTEMIS-710.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 1.4.0

PR is merged, resolving issue

> Avoid inefficient iteration over Map
> ------------------------------------
>
>                 Key: ARTEMIS-710
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-710
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>          Components: Broker
>    Affects Versions: 1.4.0
>            Reporter: Martin Styk
>            Priority: Minor
>             Fix For: 1.4.0
>
>
> On few places in Artemis code, inefficient iteration over Map object is present. 
> Example 
> {code:java}
>   Map<Thread, StackTraceElement[]> threadMap = Thread.getAllStackTraces();
>          for (Thread thread : threadMap.keySet()) {
>            StackTraceElement[] stack = threadMap.get(thread);
>            ....
> {code}
> To make it more efficient, we should use Map.Entry instead of getting keySet and than finding corresponding value.
> Places where this could be changed
> * ScaleDownHandler#scaleDownDuplicateIDs
> * PostOfficeJournalLoader#recoverPendingPageCounters
> * ActiveMQTestBase#tearDown



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)