java.lang.Object
org.apache.logging.log4j.core.config.plugins.util.PluginRegistry

public class PluginRegistry extends Object
Registry singleton for PluginType maps partitioned by source type and then by category names.
  • Field Details

    • LOGGER

      private static final Logger LOGGER
    • INSTANCE

      private static volatile PluginRegistry INSTANCE
    • INSTANCE_LOCK

      private static final Object INSTANCE_LOCK
    • pluginsByCategoryRef

      private final AtomicReference<Map<String,List<PluginType<?>>>> pluginsByCategoryRef
      Contains plugins found in Log4j2Plugins.dat cache files in the main CLASSPATH.
    • pluginsByCategoryByBundleId

      private final ConcurrentMap<Long,Map<String,List<PluginType<?>>>> pluginsByCategoryByBundleId
      Contains plugins found in Log4j2Plugins.dat cache files in OSGi Bundles.
    • pluginsByCategoryByPackage

      private final ConcurrentMap<String,Map<String,List<PluginType<?>>>> pluginsByCategoryByPackage
      Contains plugins found by searching for annotated classes at runtime.
  • Constructor Details

    • PluginRegistry

      private PluginRegistry()
  • Method Details

    • getInstance

      public static PluginRegistry getInstance()
      Returns the global PluginRegistry instance.
      Returns:
      the global PluginRegistry instance.
      Since:
      2.1
    • clear

      public void clear()
      Resets the registry to an empty state.
    • getPluginsByCategoryByBundleId

      public Map<Long,Map<String,List<PluginType<?>>>> getPluginsByCategoryByBundleId()
      Since:
      2.1
    • loadFromMainClassLoader

      public Map<String,List<PluginType<?>>> loadFromMainClassLoader()
      Since:
      2.1
    • clearBundlePlugins

      public void clearBundlePlugins(long bundleId)
      Since:
      2.1
    • loadFromBundle

      public Map<String,List<PluginType<?>>> loadFromBundle(long bundleId, ClassLoader loader)
      Since:
      2.1
    • decodeCacheFiles

      private Map<String,List<PluginType<?>>> decodeCacheFiles(ClassLoader loader)
    • loadFromPackage

      public Map<String,List<PluginType<?>>> loadFromPackage(String pkg)
      Since:
      2.1