sk.baka.webvm.analyzer.classloader
Class ClassLoaderUtils

java.lang.Object
  extended by sk.baka.webvm.analyzer.classloader.ClassLoaderUtils

public final class ClassLoaderUtils
extends Object

Contains utilities for classloader analysis.

Author:
Martin Vysny

Method Summary
static void filterClashes(Map<URI,List<ClassLoader>> map)
          Filters out regular class loader items, leaving only URIs loadable by multiple class loaders.
static List<ClassLoader> getClassLoaderChain(ClassLoader cl)
          Return the class loader parent chain as a list.
static Map<URI,List<ClassLoader>> getClassLoaderURIs(ClassLoader cl)
          Returns a map of URIs visible to class loaders.
static URL[] getURLs(ClassLoader cl)
          Returns URLs which given class loader claims to see.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getURLs

public static URL[] getURLs(ClassLoader cl)
Returns URLs which given class loader claims to see. Uses URLClassLoader.getURLs().

Parameters:
cl - the class loader to analyze
Returns:
never null, may be empty array in case the classloader is not an URLClassLoader.

getClassLoaderChain

public static List<ClassLoader> getClassLoaderChain(ClassLoader cl)
Return the class loader parent chain as a list.

Parameters:
cl - the class loader to analyze
Returns:
the chain with given class loader first and the root class loader last.

getClassLoaderURIs

public static Map<URI,List<ClassLoader>> getClassLoaderURIs(ClassLoader cl)
                                                     throws URISyntaxException
Returns a map of URIs visible to class loaders.

Parameters:
cl - the class loader to analyze
Returns:
maps URIs loadable by a class loader to a list of class loaders which are able to load the URI.
Throws:
URISyntaxException

filterClashes

public static void filterClashes(Map<URI,List<ClassLoader>> map)
Filters out regular class loader items, leaving only URIs loadable by multiple class loaders.

Parameters:
map - URI - ClassLoaders map, must not be null.


Copyright © 2010 Baka. All Rights Reserved.