@HashCodeAndEqualsPlugin.Enhance public abstract static class AgentBuilder.PoolStrategy.WithTypePoolCache extends Object implements AgentBuilder.PoolStrategy
A type locator that uses type pools but allows for the configuration of a custom cache provider by class loader. Note that a
TypePool can grow in size and that a static reference is kept to this pool by Byte Buddy's registration of a
ClassFileTransformer what can cause a memory leak if the supplied caches are not cleared on a regular basis. Also note
that a cache provider can be accessed concurrently by multiple ClassLoaders.
All types that are returned by the locator's type pool are resolved lazily.
| Modifier and Type | Class and Description |
|---|---|
static class |
AgentBuilder.PoolStrategy.WithTypePoolCache.Simple
An implementation of a type locator
AgentBuilder.PoolStrategy.WithTypePoolCache (note documentation of the linked class) that is based on a
ConcurrentMap. |
AgentBuilder.PoolStrategy.ClassLoading, AgentBuilder.PoolStrategy.Default, AgentBuilder.PoolStrategy.Eager, AgentBuilder.PoolStrategy.ExtraLazy, AgentBuilder.PoolStrategy.WithTypePoolCache| Modifier and Type | Field and Description |
|---|---|
protected TypePool.Default.WithLazyResolution.LazinessMode |
lazinessMode
The laziness mode to use for when to parse a class file.
|
protected TypePool.Default.ReaderMode |
readerMode
The reader mode to use for parsing a class file.
|
| Modifier | Constructor and Description |
|---|---|
protected |
WithTypePoolCache(TypePool.Default.ReaderMode readerMode)
Creates a new type locator that creates
TypePools but provides a custom TypePool.CacheProvider. |
protected |
WithTypePoolCache(TypePool.Default.ReaderMode readerMode,
TypePool.Default.WithLazyResolution.LazinessMode lazinessMode)
Creates a new type locator that creates
TypePools but provides a custom TypePool.CacheProvider. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract TypePool.CacheProvider |
locate(ClassLoader classLoader)
Locates a cache provider for a given class loader.
|
TypePool |
typePool(ClassFileLocator classFileLocator,
ClassLoader classLoader)
Creates a type pool for a given class file locator.
|
TypePool |
typePool(ClassFileLocator classFileLocator,
ClassLoader classLoader,
String name)
Creates a type pool for a given class file locator.
|
protected final TypePool.Default.ReaderMode readerMode
protected final TypePool.Default.WithLazyResolution.LazinessMode lazinessMode
protected WithTypePoolCache(TypePool.Default.ReaderMode readerMode)
TypePools but provides a custom TypePool.CacheProvider.readerMode - The reader mode to use for parsing a class file.protected WithTypePoolCache(TypePool.Default.ReaderMode readerMode, TypePool.Default.WithLazyResolution.LazinessMode lazinessMode)
TypePools but provides a custom TypePool.CacheProvider.readerMode - The reader mode to use for parsing a class file.lazinessMode - The laziness mode to use for when to parse a class file.public TypePool typePool(ClassFileLocator classFileLocator, @MaybeNull ClassLoader classLoader)
typePool in interface AgentBuilder.PoolStrategyclassFileLocator - The class file locator to use.classLoader - The class loader for which the class file locator was
created or null if the boot loader.public TypePool typePool(ClassFileLocator classFileLocator, @MaybeNull ClassLoader classLoader, String name)
typePool in interface AgentBuilder.PoolStrategyclassFileLocator - The class file locator to use.classLoader - The class loader for which the class file locator
was created or null if the boot loader.name - The name of the currently instrumented type.protected abstract TypePool.CacheProvider locate(@MaybeNull ClassLoader classLoader)
classLoader - The class loader for which to locate a cache. This class loader might
be null to represent the bootstrap loader.Copyright © 2014–2025. All rights reserved.