org.apache.accumulo.start.classloader
Class AccumuloClassLoader

java.lang.Object
  extended by org.apache.accumulo.start.classloader.AccumuloClassLoader

public class AccumuloClassLoader
extends Object

This class builds a hierarchy of Classloaders in the form of:

 SystemClassLoader
       ^
       |
 URLClassLoader that references the URLs for HADOOP_HOME, ZOOKEEPER_HOME, ACCUMULO_HOME and their associated directories
       ^
       |
 URLClassLoader that references ACCUMULO_HOME/lib/ext, locations from the ACCUMULO property general.dynamic.classpaths and $ACCUMULO_XTRAJARS
 
The last URLClassLoader in the chain monitors the directories for changes every 3 seconds (default value). If a change occurs, the last URLClassLoader is abandoned and a new one is created. Objects that still reference the abandoned URLClassLoader will cause it to not be garbage collected until those objects are garbage collected. If reload happens often enough it may cause excessive memory usage.


Field Summary
static String ACCUMULO_CLASSPATH_VALUE
           
static String CLASSPATH_PROPERTY_NAME
           
static String DEFAULT_CLASSPATH_VALUE
           
static String DEFAULT_DYNAMIC_CLASSPATH_VALUE
          Dynamic classpath.
static String DYNAMIC_CLASSPATH_PROPERTY_NAME
           
 
Constructor Summary
AccumuloClassLoader()
           
 
Method Summary
static String getAccumuloClasspathStrings()
           
static String getAccumuloDynamicClasspathStrings()
           
static ClassLoader getClassLoader()
           
static Class<?> loadClass(String classname)
           
static
<U> Class<? extends U>
loadClass(String classname, Class<U> extension)
           
static void printClassPath()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSPATH_PROPERTY_NAME

public static final String CLASSPATH_PROPERTY_NAME
See Also:
Constant Field Values

DYNAMIC_CLASSPATH_PROPERTY_NAME

public static final String DYNAMIC_CLASSPATH_PROPERTY_NAME
See Also:
Constant Field Values

ACCUMULO_CLASSPATH_VALUE

public static final String ACCUMULO_CLASSPATH_VALUE
See Also:
Constant Field Values

DEFAULT_DYNAMIC_CLASSPATH_VALUE

public static final String DEFAULT_DYNAMIC_CLASSPATH_VALUE
Dynamic classpath. These locations will be monitored for changes.

See Also:
Constant Field Values

DEFAULT_CLASSPATH_VALUE

public static final String DEFAULT_CLASSPATH_VALUE
See Also:
Constant Field Values
Constructor Detail

AccumuloClassLoader

public AccumuloClassLoader()
Method Detail

getAccumuloDynamicClasspathStrings

public static String getAccumuloDynamicClasspathStrings()
                                                 throws IllegalStateException
Throws:
IllegalStateException

getAccumuloClasspathStrings

public static String getAccumuloClasspathStrings()
                                          throws IllegalStateException
Throws:
IllegalStateException

printClassPath

public static void printClassPath()

loadClass

public static <U> Class<? extends U> loadClass(String classname,
                                               Class<U> extension)
                                    throws ClassNotFoundException
Throws:
ClassNotFoundException

loadClass

public static Class<?> loadClass(String classname)
                          throws ClassNotFoundException
Throws:
ClassNotFoundException

getClassLoader

public static ClassLoader getClassLoader()
                                  throws IOException
Throws:
IOException


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.