Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-25969

JiraPluginSettingsFactory.createSettingsForKey(projectKey) should not load eagerly and the result should be cached for the rest of the request

XMLWordPrintable

    • We collect Jira feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      NOTE: This suggestion is for JIRA Server. Using JIRA Cloud? See the corresponding suggestion.

      The bit of code:

          public PluginSettings createSettingsForKey(final String key)
          {
              Supplier<? extends PropertySet> propertySet = null;
              if (key != null)
              {
                  propertySet = Suppliers.memoize(LazyProjectMigratingPropertySet.create(projectManager, jiraPropertySetFactory,
                                  jiraPropertySetFactory.buildCachingDefaultPropertySet(key, true), key));
              }
              else
              {
                  ...
              }
              return new JiraPluginSettings(propertySet);
          }
      

      When the project key is passed in the parameter, this will always call jiraPropertySetFactory.buildCachingDefaultPropertySet(key, true) first, which will build the NON-caching property set and eagerly load it.

      Since this is project key related, the client code is unlikely to keep a reference to it other than using it as a local variable, it would be great if the result is cached in the request thread locals, as many plugins may have to call this when serving the same request.

      Attached is an inCallOrder recorded for one request that has the plugin settings for project 'BMW' loaded for dozen of times.

              Unassigned Unassigned
              awei Alex Wei (DE)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: