Uploaded image for project: 'mod-authtoken'
  1. mod-authtoken
  2. MODAT-82

Replace linear search MainVerticle.LimitedSizeQueue

    XMLWordPrintable

    Details

    • Template:
    • Sprint:
      CP: sprint 104
    • Story Points:
      1
    • Development Team:
      Core: Platform

      Description

      MainVerticle.LimitedSizeQueue<K> extends ArrayList<K>: https://github.com/folio-org/mod-authtoken/blob/v2.6.0/src/main/java/org/folio/auth/authtokenmodule/MainVerticle.java#L874-L889

      tokenCache.contains(authToken) is a linear search through the array: https://github.com/folio-org/mod-authtoken/blob/v2.6.0/src/main/java/org/folio/auth/authtokenmodule/MainVerticle.java#L496

      Use a better implementation, for example
      https://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashMap.html
      with

      @Override
      protected boolean removeEldestEntry(Map.Entry eldest) {
        return size() > MAX_ENTRIES;
      }
      

      On top of that the current implementation is broken. Size of LimitedSizeQueue is not limited. Size of queue may be larger than maxSize.

        TestRail: Results

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                adam Adam Dickmeiss
                Reporter:
                julianladisch Julian Ladisch
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    TestRail: Runs

                      TestRail: Cases