org.kuali.rice.core.api.util
Class ContextClassLoaderBinder

java.lang.Object
  extended by org.kuali.rice.core.api.util.ContextClassLoaderBinder

public final class ContextClassLoaderBinder
extends Object

Utility class that binds/unbinds the context ClassLoader of the current Thread using a ThreadLocal. NOTE: doInContextClassLoader(ClassLoader, java.util.concurrent.Callable) is the only safe way to use this class, do not use deprecated bind(ClassLoader) or unbind() methods.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Constructor Summary
ContextClassLoaderBinder()
           
 
Method Summary
static void bind(ClassLoader cl)
          Deprecated. use #doInContextClassLoader
static
<T> T
doInContextClassLoader(ClassLoader cl, Callable<T> callable)
          Execute a runnable under a given context classloader
static void unbind()
          Deprecated. use #doInContextClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextClassLoaderBinder

public ContextClassLoaderBinder()
Method Detail

bind

public static void bind(ClassLoader cl)
Deprecated. use #doInContextClassLoader


unbind

public static void unbind()
Deprecated. use #doInContextClassLoader


doInContextClassLoader

public static <T> T doInContextClassLoader(ClassLoader cl,
                                           Callable<T> callable)
                                throws Exception
Execute a runnable under a given context classloader

Parameters:
cl - the classloader to set as the thread context classloader
callable - the callable
Throws:
Exception


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.