public interface ClassLoaderFilter
Profile
class is loaded by the "
application" classloader. This can be a problem because
it's possble that classed that are loaded by other classloaders
(like the extensions classloader) might be instrumented to make
calls to the profiler. This results in a
ClassNotFoundException
, which is not good. To make matters worse,
which classloader is the "application" classloader varies
depending on your environment. For example, a web app running under
Tomcat will have a different "Application" classloader
than a stand alone application.
To get around this, JIP uses ClassLoaderFiler
. Implementations
of this class do two things:
ClassLoaderFilter
for a given runtime environment.ClassLoader
is the
"Application" classloader.ClassLoaderFiler
is by
going though a number of implementations until it finds one that
canFilter()
in the given environment. This is accomplished
by configuring the profile properties file.
For example, the default properties file has a
section that looks like:
ClassLoaderFilter.1=com.mentorgen.tools.profile.WebAppClassLoaderFilter
ClassLoaderFilter.2=com.mentorgen.tools.profile.StandardClassLoaderFilter
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.lang.ClassLoader loader)
Tries to determine if the given
ClassLoader
is the "application classloader". |
boolean |
canFilter()
This method examines the environment to determine if
it can be used to filter by
ClassLoader . |
boolean canFilter()
ClassLoader
.
For example, a realization of this class for Tomcat
might look for Tomcat's VM parameters to determine
if the Tomcat is running in the VM.boolean accept(java.lang.ClassLoader loader)
ClassLoader
is the "application classloader". What this means exactly
is dependent on the type of application (that is, this is
different for Tomcat than for a standalone app)loader
-