Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-710

Avoid inefficient iteration over Map

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.4.0
    • 1.4.0
    • Broker
    • None

    Description

      On few places in Artemis code, inefficient iteration over Map object is present.
      Example

        Map<Thread, StackTraceElement[]> threadMap = Thread.getAllStackTraces();
               for (Thread thread : threadMap.keySet()) {
                 StackTraceElement[] stack = threadMap.get(thread);
                 ....
      

      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

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mstyk Martin Styk
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: