ehcache

net.sf.ehcache.util
Class ClassLoaderUtil

java.lang.Object
  extended by net.sf.ehcache.util.ClassLoaderUtil

public final class ClassLoaderUtil
extends java.lang.Object

Keeps all classloading in ehcache consistent.

Version:
$Id: ClassLoaderUtil.java 519 2007-07-27 07:11:45Z gregluck $
Author:
Greg Luck

Method Summary
static java.lang.Object createNewInstance(java.lang.String className)
          Creates a new class instance.
static java.lang.ClassLoader getFallbackClassLoader()
          Gets a fallback ClassLoader that all classes in ehcache, and extensions, should use for classloading.
static java.lang.ClassLoader getStandardClassLoader()
          Gets the ClassLoader that all classes in ehcache, and extensions, should use for classloading.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getStandardClassLoader

public static java.lang.ClassLoader getStandardClassLoader()
Gets the ClassLoader that all classes in ehcache, and extensions, should use for classloading. All ClassLoading in ehcache should use this one. This is the only thing that seems to work for all of the class loading situations found in the wild.

Returns:
the thread context class loader.

getFallbackClassLoader

public static java.lang.ClassLoader getFallbackClassLoader()
Gets a fallback ClassLoader that all classes in ehcache, and extensions, should use for classloading. This is used if the context class loader does not work.

Returns:
the ClassLoaderUtil.class.getClassLoader();

createNewInstance

public static java.lang.Object createNewInstance(java.lang.String className)
                                          throws CacheException
Creates a new class instance. Logs errors along the way. Classes are loaded using the ehcache standard classloader.

Parameters:
className - a fully qualified class name
Returns:
null if the instance cannot be loaded
Throws:
CacheException

ehcache