Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-5828

(7.1.0) Avoid inefficient iteration over Map

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Optional Optional
    • 7.1.0.DR8
    • 7.1.0.DR3
    • ActiveMQ
    • None

      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

            mstyk_jira Martin Styk (Inactive)
            mstyk_jira Martin Styk (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: