@HashCodeAndEqualsPlugin.Enhance public static class AgentBuilder.PoolStrategy.WithTypePoolCache.Simple extends AgentBuilder.PoolStrategy.WithTypePoolCache
AgentBuilder.PoolStrategy.WithTypePoolCache
(note documentation of the linked class) that is based on a
ConcurrentMap
. It is the responsibility of the type locator's user to avoid the type locator from leaking memory.AgentBuilder.PoolStrategy.WithTypePoolCache.Simple
AgentBuilder.PoolStrategy.ClassLoading, AgentBuilder.PoolStrategy.Default, AgentBuilder.PoolStrategy.Eager, AgentBuilder.PoolStrategy.WithTypePoolCache
readerMode
Constructor and Description |
---|
Simple(ConcurrentMap<? super ClassLoader,TypePool.CacheProvider> cacheProviders)
Creates a new type locator that caches a cache provider per class loader in a concurrent map.
|
Simple(TypePool.Default.ReaderMode readerMode,
ConcurrentMap<? super ClassLoader,TypePool.CacheProvider> cacheProviders)
Creates a new type locator that caches a cache provider per class loader in a concurrent map.
|
Modifier and Type | Method and Description |
---|---|
protected ClassLoader |
getBootstrapMarkerLoader()
Returns the class loader to serve as a cache key if a cache provider for the bootstrap class loader is requested.
|
protected TypePool.CacheProvider |
locate(ClassLoader classLoader)
Locates a cache provider for a given class loader.
|
typePool, typePool
public Simple(ConcurrentMap<? super ClassLoader,TypePool.CacheProvider> cacheProviders)
TypePool.Default.ReaderMode
.cacheProviders
- The concurrent map that is used for storing a cache provider per class loader.public Simple(TypePool.Default.ReaderMode readerMode, ConcurrentMap<? super ClassLoader,TypePool.CacheProvider> cacheProviders)
readerMode
- The reader mode to use for parsing a class file.cacheProviders
- The concurrent map that is used for storing a cache provider per class loader.protected TypePool.CacheProvider locate(ClassLoader classLoader)
AgentBuilder.PoolStrategy.WithTypePoolCache
locate
in class AgentBuilder.PoolStrategy.WithTypePoolCache
classLoader
- The class loader for which to locate a cache. This class loader might be null
to represent the bootstrap loader.protected ClassLoader getBootstrapMarkerLoader()
Returns the class loader to serve as a cache key if a cache provider for the bootstrap class loader is requested.
This class loader is represented by null
in the JVM which is an invalid value for many ConcurrentMap
implementations.
By default, ClassLoader.getSystemClassLoader()
is used as such a key as any resource location for the
bootstrap class loader is performed via the system class loader within Byte Buddy as null
cannot be queried
for resources via method calls such that this does not make a difference.
Copyright © 2014–2021. All rights reserved.