Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-7003

CLONE - DefaultMessageBundlesLoader is always re-instantiated in order to reflect changes in message bundle

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Neutral Neutral
    • None
    • None
    • None
    • None
    • 5

      No matter what I do, changes in message bundles are not reloaded.
      Using:
      light-modules in a hybrid state (within a Maven module).
      Only a restart of the server loads them (missing the old "reload message bundles" app ).

      From the original ticket:
      While QAing MAGNOLIA-6724 & MGNLGROOVY-143 we found that info.magnolia.i18nsystem.DefaultMessageBundlesLoader#logDuplicates and its verbose output in the log was printed twice – once upon component initialisation and once when calling info.magnolia.i18nsystem.TranslationServiceImpl#reloadMessageBundles.

      The reason is that info.magnolia.i18nsystem.TranslationServiceImpl#setupMessageBundles creates a new instance of DefaultMessageBundlesLoader for each call, therefore omitting the component definition in META-INF/magnolia/i18n.xml of the i18n module.

      It would be desirable to use

      protected DefaultMessageBundlesLoader setupMessageBundles() {
          return componentProvider.getComponent(DefaultMessageBundlesLoader.class);
      }
      

      instead of

      protected DefaultMessageBundlesLoader setupMessageBundles() {
          return componentProvider.newInstance(DefaultMessageBundlesLoader.class, resourceOrigin);
      }
      

      in order to only maintain one component and therefore preventing potential memory leaks.

      However this will prevent for any changes in message properties files to be reflected in the translation service during runtime. Possible workaround could be to add the possibility to reload message property files in DefaultMessageBundlesLoader or make it aware of changes in origins (info.magnolia.resourceloader.ResourceOriginChange). Ideally we move registration of the event handler for ModulesStartedEvent to the component DefaultMessageBundlesLoader.

      We should investigate and also find out why the new instance call was added in the first place and what impact above change could have.

        Acceptance criteria

              Unassigned Unassigned
              cringele Christian Ringele
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:

                  Task DoD