public interface ClassLoadingService
Modifier and Type | Method and Description |
---|---|
java.lang.ClassLoader |
createBundleAddOnClassLoader(java.util.List<java.io.File> classPath,
java.lang.ClassLoader gwClassLoader,
ClassLoaderConfiguration config)
This method creates a classloader for use from within a bundle.
|
java.lang.ClassLoader |
createChildClassLoader(java.util.List<com.ibm.wsspi.adaptable.module.Container> classpath,
ClassLoaderConfiguration config)
This method creates a lower level class loader, such as a module class loader.
|
ClassLoaderConfiguration |
createClassLoaderConfiguration() |
GatewayConfiguration |
createGatewayConfiguration() |
ClassLoaderIdentity |
createIdentity(java.lang.String domain,
java.lang.String id)
This creates an immutable ClassLoaderIdentity.
|
java.lang.ClassLoader |
createThreadContextClassLoader(java.lang.ClassLoader applicationClassLoader)
This will augment the application class loader with the ability to see more internal packages.
|
java.lang.ClassLoader |
createTopLevelClassLoader(java.util.List<com.ibm.wsspi.adaptable.module.Container> classPath,
GatewayConfiguration gwConfig,
ClassLoaderConfiguration config)
This method creates a top level class loader.
|
void |
destroyThreadContextClassLoader(java.lang.ClassLoader unifiedClassLoader)
This will destroy the thread context class loader.
|
java.lang.ClassLoader |
getShadowClassLoader(java.lang.ClassLoader loader)
Attempt to create a
ClassLoader that can be used to introspect
the classes on the class path of the provided ClassLoader without
loading them directly. |
java.lang.ClassLoader |
getSharedLibraryClassLoader(Library lib)
Create or retrieve the shared class loader for a shared library.
|
boolean |
isAppClassLoader(java.lang.ClassLoader cl)
This method returns whether or not the provided ClassLoader object
is an instance of an AppClassLoader.
|
boolean |
isThreadContextClassLoader(java.lang.ClassLoader cl)
This method returns whether or not the provided ClassLoader object
is an instance of an ThreadContextClassLoader.
|
boolean |
registerTransformer(ClassTransformer transformer,
java.lang.ClassLoader loader)
Attempt to register a
ClassTransformer with a ClassLoader . |
void |
setSharedLibraryProtectionDomains(java.util.Map<java.lang.String,java.security.ProtectionDomain> protectionDomainMap) |
java.lang.ClassLoader |
unify(java.lang.ClassLoader parent,
java.lang.ClassLoader... classloaders)
This method builds a classloader that delegates to the provided classloaders in order.
|
boolean |
unregisterTransformer(ClassTransformer transformer,
java.lang.ClassLoader loader)
Attempt to unregister a
ClassTransformer from a ClassLoader . |
java.lang.ClassLoader createTopLevelClassLoader(java.util.List<com.ibm.wsspi.adaptable.module.Container> classPath, GatewayConfiguration gwConfig, ClassLoaderConfiguration config)
Once the configuration objects are passed in, they belong to the ClassLoadingService. They should not be modified or re-used for other invocations.
N.B. it is the caller's responsibility to ensure that this method is not
called concurrently for the same or equivalent ClassLoaderIdentity
objects.
The results of concurrent invocation for the same identity are not defined.
classPath
- A list of URLs that should be used to load classesgwConfig
- The desired configuration for the gateway.config
- The desired configuration of the ClassLoader.java.lang.ClassLoader createBundleAddOnClassLoader(java.util.List<java.io.File> classPath, java.lang.ClassLoader gwClassLoader, ClassLoaderConfiguration config)
Once the configuration objects are passed in, they belong to the ClassLoadingService. They should not be modified or re-used for other invocations.
N.B. it is the caller's responsibility to ensure that this method is not
called concurrently for the same or equivalent ClassLoaderIdentity
objects.
The results of concurrent invocation for the same identity are not defined.
classPath
- A list of URLs that should be used to load classesgwClassLoader
- The gateway ClassLoader.config
- The desired configuration of the ClassLoader.java.lang.ClassLoader createChildClassLoader(java.util.List<com.ibm.wsspi.adaptable.module.Container> classpath, ClassLoaderConfiguration config)
Once the configuration objects are passed in, they belong to the ClassLoadingService. They should not be modified or re-used for other invocations.
N.B. it is the caller's responsibility to ensure that this method is not
called concurrently for the same or equivalent ClassLoaderIdentity
objects.
The results of concurrent invocation for the same identity are not defined.
classpath
- A list of URLs that should be used to load classesconfig
- The desired configuration of the ClassLoader.GatewayConfiguration createGatewayConfiguration()
ClassLoaderConfiguration createClassLoaderConfiguration()
ClassLoaderIdentity createIdentity(java.lang.String domain, java.lang.String id)
domain
- a unique name indicating the domain (i.e. the user) of the class loaderid
- an id unique within the domainjava.lang.ClassLoader getShadowClassLoader(java.lang.ClassLoader loader)
ClassLoader
that can be used to introspect
the classes on the class path of the provided ClassLoader
without
loading them directly. The returned ClassLoader
should be
discarded as early as possible to allow it and all its classes to be
garbage-collected.loader
- the class loader to cloneClassLoader
or null
if loader
was not created by this servicejavax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader()
boolean registerTransformer(ClassTransformer transformer, java.lang.ClassLoader loader)
ClassTransformer
with a ClassLoader
.transformer
- the ClassTransformer
to be registeredloader
- the ClassLoader
to be modifiedtrue
if the operation succeeded, false
if the ClassLoader
was not created by this ClassLoadingService
.boolean unregisterTransformer(ClassTransformer transformer, java.lang.ClassLoader loader)
ClassTransformer
from a ClassLoader
.transformer
- the ClassTransformer
to be unregisteredloader
- the ClassLoader
to be modifiedtrue
if loader
was modified,
false
if it was not a classloader created by this service
or if transformer
was never registered with it.java.lang.ClassLoader unify(java.lang.ClassLoader parent, java.lang.ClassLoader... classloaders)
parent
- the first classloader to queryclassloaders
- the class loaders to unify,java.lang.ClassLoader getSharedLibraryClassLoader(Library lib)
lib
- the shared library to create a class loader forjava.lang.ClassLoader createThreadContextClassLoader(java.lang.ClassLoader applicationClassLoader)
destroyed
when it is no longer needed.,
in order to avoid leaking this loader (and all classes it loaded).applicationClassLoader
- The application class loader to augmentvoid destroyThreadContextClassLoader(java.lang.ClassLoader unifiedClassLoader)
unifiedClassLoader
- The thread context class loaderboolean isAppClassLoader(java.lang.ClassLoader cl)
cl
- The class loader object to analyze.boolean isThreadContextClassLoader(java.lang.ClassLoader cl)
cl
- The class loader object to analyze.void setSharedLibraryProtectionDomains(java.util.Map<java.lang.String,java.security.ProtectionDomain> protectionDomainMap)
protectionDomainMap
-