Class HelperClassManager.ForSingleClassLoader<T>

  • Type Parameters:
    T - the type of the helper class interface
    Enclosing class:
    HelperClassManager<T>

    @Deprecated
    public static class HelperClassManager.ForSingleClassLoader<T>
    extends HelperClassManager<T>
    Deprecated.
    Use indy plugins instead. As the whole package the indy plugin is defined it is loaded from IndyPluginClassLoader, a separate helper class manager is not needed anymore.
    This helper class manager assumes that there is only one ClassLoader which loads the classes, the helper class references.

    This is true, for example, for the JDBC and the Servlet API. There is only one canonical class for these types.

    However, this does not work if the helper class references types, which can be loaded by multiple class loaders. An example would be framework or library types, which are part of an application deployed to a servlet container. There could be multiple applications, using the same type, loaded by different application class loaders, which makes them distinct runtime types.

    Note that the helperImplementation's classloader references the target classloader as it's parent. This class does not weakly reference the helperImplementation. It is assumed that because there is only one classloader involved, there can't be a leakage of this classloader by keeping around the helperImplementation. The situation would be differently when referring to types loaded by a web application classloader, which has to be collectible when the web application is un-deployed.

    • Method Detail

      • doGetForClassLoaderOfClass

        @Nullable
        public T doGetForClassLoaderOfClass​(java.lang.Class<?> classOfTargetClassLoader)
        Deprecated.
        Description copied from class: HelperClassManager
        Implementations of this method are expected to load helper classes lazily, meaning when invoked for the first time. By delaying the helper class loading only to when actually required (normally from the injected code) we ensure proper classpath is already in place.
        Specified by:
        doGetForClassLoaderOfClass in class HelperClassManager<T>
        Parameters:
        classOfTargetClassLoader - a class loaded by the class loader we want to load the helper class from
        Returns:
        helper instance