com.mentorgen.tools.profile.instrument.clfilter
Interface ClassLoaderFilter

All Known Implementing Classes:
ExtensionsClassLoaderFilter, GenericClassLoaderFilter, Info, JBossEJBClassLoaderFilter, JBossServletClassLoaderFilter, JBossUniversalClassLoaderFilter, StandardClassLoaderFilter, TomcatInternalClassLoaderFilter, WebAppClassLoaderFilter

public interface ClassLoaderFilter

The 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:

  1. Determine if they are the right ClassLoaderFilter for a given runtime environment.
  2. Determine if a given ClassLoader is the "Application" classloader.
The way JIP chooses the right 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
                        

Author:
Andrew Wilcox

Method Summary
 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.
 

Method Detail

canFilter

boolean canFilter()
This method examines the environment to determine if it can be used to filter by 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.


accept

boolean accept(java.lang.ClassLoader loader)
Tries to determine if the given 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)

Parameters:
loader -