[infinispan-issues] [JBoss JIRA] (ISPN-9541) Modules should not replace components after they were registered

Dan Berindei (JIRA) issues at jboss.org
Tue Sep 25 12:12:00 EDT 2018


Dan Berindei created ISPN-9541:
----------------------------------

             Summary: Modules should not replace components after they were registered
                 Key: ISPN-9541
                 URL: https://issues.jboss.org/browse/ISPN-9541
             Project: Infinispan
          Issue Type: Bug
          Components: Core, Server
    Affects Versions: 9.4.0.CR3
            Reporter: Dan Berindei
            Assignee: Dan Berindei
             Fix For: 9.4.0.Final


In my ISPN-9127 fix I created a {{BasicComponentRegistry}} interface that represents a  mostly-read-only collection of components. It has {{replaceComponent()}} method and a {{rewire()}} method for testing purposes, but it turns out modules were also relying on the ability to replace existing components in order to work.

Replacing global components is normally safe during the {{ModuleLifecycle.cacheManagerStarting()}}, because none of the components are started yet, so when a component starts later we can still start its dependencies first. But because some modules starts some global components, e.g. by calling {{manager.getCache(name)}}, that assumption breaks.

The {{infinispan-server-event-logger}} module is a bit more sneaky: it doesn't replace a component, instead it replaces the actual implementation of the event logger in the {{EventLogManager}} component. Events that happen before the module's {{cacheManagerStarting()}} or after {{cacheManagerStopping()}} will be silently dropped from the persistent event log.

I am investigating making the module a factory of factories. Instead of having a monolitic {{cacheManagerStarting()}} method, it could define a set of components that it can create, and a set of components that should be started before the cache manager is "running". We probably need a way to depend on other modules as well, maybe reusing the {{@Inject}} and {{@ComponentName}} annotations.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the infinispan-issues mailing list