Class SoftlyReferencingTypePoolCache
- java.lang.Object
-
- net.bytebuddy.agent.builder.AgentBuilder.PoolStrategy.WithTypePoolCache
-
- co.elastic.apm.agent.bci.bytebuddy.SoftlyReferencingTypePoolCache
-
- All Implemented Interfaces:
net.bytebuddy.agent.builder.AgentBuilder.PoolStrategy
public class SoftlyReferencingTypePoolCache extends net.bytebuddy.agent.builder.AgentBuilder.PoolStrategy.WithTypePoolCacheCachesTypeDescriptions which speeds up type matching - especially when the matching requires lookup of otherTypeDescriptions. Such as when in order to match a type, it's superclass has to be determined. Without a type pool cache those types would have to be re-loaded from the file system if theirClasshas not been loaded yet.In order to avoid
OutOfMemoryErrors because of this cache, theTypePool.CacheProviders are wrapped in aSoftReference. If the underlying cache is being GC'ed, a new one is immediately being created instead, so to both prevent OOME and enable continuous caching. Any cache that is not being accessed for some time (configurable through constructor), is being cleared, so that caches don't occupy heap memory until there is a heap stress. This fits the typical pattern of most type matching occurring at the beginning of the agent attachment.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.bytebuddy.agent.builder.AgentBuilder.PoolStrategy.WithTypePoolCache
net.bytebuddy.agent.builder.AgentBuilder.PoolStrategy.WithTypePoolCache.Simple
-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.AgentBuilder.PoolStrategy
net.bytebuddy.agent.builder.AgentBuilder.PoolStrategy.ClassLoading, net.bytebuddy.agent.builder.AgentBuilder.PoolStrategy.Default, net.bytebuddy.agent.builder.AgentBuilder.PoolStrategy.Eager, net.bytebuddy.agent.builder.AgentBuilder.PoolStrategy.WithTypePoolCache
-
-
Constructor Summary
Constructors Constructor Description SoftlyReferencingTypePoolCache(net.bytebuddy.pool.TypePool.Default.ReaderMode readerMode, int clearIfNotAccessedSinceMinutes, net.bytebuddy.matcher.ElementMatcher.Junction<java.lang.ClassLoader> ignoredClassLoaders)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected net.bytebuddy.pool.TypePool.CacheProviderlocate(java.lang.ClassLoader classLoader)
-