Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-245

Core module to delegate lifecycle events to sub-modules

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Done
    • Major
    • 4.0.0.CR4
    • None
    • Core
    • None
    • Medium

    Description

      Follow a 'service registry' style approach to delegating lifecycle events so that modules can register for hooks. The purpose behind this is that some modules need to perform some setup. E.g., the 'tree' module needs to register specific types with the Marshaller. The 'query' module needs to register an interceptor with the Cache if the Cache has enabled querying. Etc.

      The approach is to use a JDK service registry style approach. The Core module defines a ModuleLifecycle interface:

      interface ModuleLifecycle {
      void cacheManagerStarting(GlobalComponentRegistry gcr);
      void cacheManagerStarted(GlobalComponentRegistry gcr);
      void cacheManagerStopping(GlobalComponentRegistry gcr);
      void cacheManagerStopped(GlobalComponentRegistry gcr);

      void cacheStarting(ComponentRegistry cr, String cacheName);
      void cacheStarted(ComponentRegistry cr, String cacheName);
      void cacheStopping(ComponentRegistry cr, String cacheName);
      void cacheStopped(ComponentRegistry cr, String cacheName);
      }

      each module would implement this interface.

      "Registration" is performed by each module maintaining a infinispan-module-info.properties file in its classpath, containing:
      infinispan.module.lifecycle=<ModuleLifecycle impl>

      The DefaultCacheManager, when starting up, scans its classpath for "infinispan-module-info.properties" and registers all listeners. Everytime the cache manager starts, stops, or caches start or stop, the appropriate callbacks are invoked.

      Attachments

        Issue Links

          Activity

            People

              vblagoje Vladimir Blagojevic (Inactive)
              manik_jira Manik Surtani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: