Class HelperClassManager.ForSingleClassLoader<T>
- java.lang.Object
-
- co.elastic.apm.agent.bci.HelperClassManager<T>
-
- co.elastic.apm.agent.bci.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.Useindy pluginsinstead. As the whole package the indy plugin is defined it is loaded fromIndyPluginClassLoader, a separate helper class manager is not needed anymore.This helper class manager assumes that there is only oneClassLoaderwhich 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 thehelperImplementation. It is assumed that because there is only one classloader involved, there can't be a leakage of this classloader by keeping around thehelperImplementation. 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class co.elastic.apm.agent.bci.HelperClassManager
HelperClassManager.ForAnyClassLoader<T>, HelperClassManager.ForSingleClassLoader<T>
-
-
Field Summary
-
Fields inherited from class co.elastic.apm.agent.bci.HelperClassManager
additionalHelpers, implementation, tracer
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description TdoGetForClassLoaderOfClass(java.lang.Class<?> classOfTargetClassLoader)Deprecated.Implementations of this method are expected to load helper classes lazily, meaning when invoked for the first time.static <T> HelperClassManager.ForSingleClassLoader<T>of(ElasticApmTracer tracer, java.lang.String implementation, java.lang.String... additionalHelpers)Deprecated.Not loading and instantiating helper class yet, just prepares the manager-
Methods inherited from class co.elastic.apm.agent.bci.HelperClassManager
getForClassLoaderOfClass
-
-
-
-
Method Detail
-
of
public static <T> HelperClassManager.ForSingleClassLoader<T> of(ElasticApmTracer tracer, java.lang.String implementation, java.lang.String... additionalHelpers)
Deprecated.Not loading and instantiating helper class yet, just prepares the manager
-
doGetForClassLoaderOfClass
@Nullable public T doGetForClassLoaderOfClass(java.lang.Class<?> classOfTargetClassLoader)
Deprecated.Description copied from class:HelperClassManagerImplementations 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:
doGetForClassLoaderOfClassin classHelperClassManager<T>- Parameters:
classOfTargetClassLoader- a class loaded by the class loader we want to load the helper class from- Returns:
- helper instance
-
-