org.eclipse.osgi.baseadaptor.hooks
Interface ClassLoadingStatsHook


public interface ClassLoadingStatsHook

A ClassLoadingStatsHook hooks into the ClasspathManager class. This class allows a hook to record statistics about classloading.

Since:
3.2
See Also:
ClasspathManager, HookRegistry.getClassLoadingStatsHooks(), HookRegistry.addClassLoadingStatsHook(ClassLoadingStatsHook)

Method Summary
 void postFindLocalClass(java.lang.String name, java.lang.Class clazz, ClasspathManager manager)
          Gets called by a classpath manager during ClasspathManager.findLocalClass(String) after searching the local classloader for a class.
 void postFindLocalResource(java.lang.String name, java.net.URL resource, ClasspathManager manager)
          Gets called by a classpath manager during ClasspathManager.findLocalResource(String) after searching the local classloader for a resource.
 void preFindLocalClass(java.lang.String name, ClasspathManager manager)
          Gets called by a classpath manager during ClasspathManager.findLocalClass(String) before searching the local classloader for a class.
 void preFindLocalResource(java.lang.String name, ClasspathManager manager)
          Gets called by a classpath manager during ClasspathManager.findLocalResource(String) before searching the local classloader for a resource.
 void recordClassDefine(java.lang.String name, java.lang.Class clazz, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager)
          Gets called by a classpath manager after a successfully defining a class.
 

Method Detail

preFindLocalClass

void preFindLocalClass(java.lang.String name,
                       ClasspathManager manager)
                       throws java.lang.ClassNotFoundException
Gets called by a classpath manager during ClasspathManager.findLocalClass(String) before searching the local classloader for a class. A classpath manager will call this method for each configured class loading stat hook.

Parameters:
name - the name of the requested class
manager - the classpath manager used to find and load the requested class
Throws:
java.lang.ClassNotFoundException - to prevent the requested class from loading

postFindLocalClass

void postFindLocalClass(java.lang.String name,
                        java.lang.Class clazz,
                        ClasspathManager manager)
                        throws java.lang.ClassNotFoundException
Gets called by a classpath manager during ClasspathManager.findLocalClass(String) after searching the local classloader for a class. A classpath manager will call this method for each configured class loading stat hook.

Parameters:
name - the name of the requested class
clazz - the loaded class or null if not found
manager - the classpath manager used to find and load the requested class
Throws:
java.lang.ClassNotFoundException

preFindLocalResource

void preFindLocalResource(java.lang.String name,
                          ClasspathManager manager)
Gets called by a classpath manager during ClasspathManager.findLocalResource(String) before searching the local classloader for a resource. A classpath manager will call this method for each configured class loading stat hook.

Parameters:
name - the name of the requested resource
manager - the classpath manager used to find the requested resource

postFindLocalResource

void postFindLocalResource(java.lang.String name,
                           java.net.URL resource,
                           ClasspathManager manager)
Gets called by a classpath manager during ClasspathManager.findLocalResource(String) after searching the local classloader for a resource. A classpath manager will call this method for each configured class loading stat hook.

Parameters:
name - the name of the requested resource
resource - the URL to the requested resource or null if not found
manager - the classpath manager used to find the requested resource

recordClassDefine

void recordClassDefine(java.lang.String name,
                       java.lang.Class clazz,
                       byte[] classbytes,
                       ClasspathEntry classpathEntry,
                       BundleEntry entry,
                       ClasspathManager manager)
Gets called by a classpath manager after a successfully defining a class. This method allows a class loading stat hook to record data about a class definition.

Parameters:
name - the name of the class that got defined
clazz - the class object that got defined
classbytes - the class bytes used to define the class
classpathEntry - the ClasspathEntry where the class bytes got read from
entry - the BundleEntyr source of the class bytes
manager - the classpath manager used to define the class