activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARTEMIS-710) Avoid inefficient iteration over Map
Date Wed, 31 Aug 2016 14:42:20 GMT

    [ https://issues.apache.org/jira/browse/ARTEMIS-710?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15452412#comment-15452412
] 

ASF GitHub Bot commented on ARTEMIS-710:
----------------------------------------

GitHub user MartinStyk opened a pull request:

    https://github.com/apache/activemq-artemis/pull/745

    ARTEMIS-710 Avoid inefficient iteration over Map

    https://issues.apache.org/jira/browse/ARTEMIS-710

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MartinStyk/activemq-artemis map_efficiency

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq-artemis/pull/745.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #745
    
----
commit 21727964ba2e028bf4f985bf60f089b90406814b
Author: Martin Styk <mstyk@redhat.com>
Date:   2016-08-31T14:36:09Z

    ARTEMIS-710 Avoid inefficient iteration over Map

----


> 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
>
> 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)

Mime
View raw message