com.cloudera.sqoop.util
Class ClassLoaderStack

java.lang.Object
  extended by com.cloudera.sqoop.util.ClassLoaderStack

public final class ClassLoaderStack
extends java.lang.Object

Allows you to add and remove jar-files from the running JVM by instantiating classloaders for them.


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Method Summary
static java.lang.ClassLoader addJarFile(java.lang.String jarFile, java.lang.String testClassName)
          Adds a ClassLoader to the top of the stack that will load from the Jar file of your choice.
static void setCurrentClassLoader(java.lang.ClassLoader cl)
          Sets the classloader for the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Method Detail

setCurrentClassLoader

public static void setCurrentClassLoader(java.lang.ClassLoader cl)
Sets the classloader for the current thread.


addJarFile

public static java.lang.ClassLoader addJarFile(java.lang.String jarFile,
                                               java.lang.String testClassName)
                                        throws java.io.IOException
Adds a ClassLoader to the top of the stack that will load from the Jar file of your choice. Returns the previous classloader so you can restore it if need be, later.

Parameters:
jarFile - The filename of a jar file that you want loaded into this JVM.
testClassName - The name of the class to load immediately (optional).
Throws:
java.io.IOException


Copyright © 2010 Cloudera, Inc.