Package com.liferay.petra.lang
Class ClassLoaderPool
java.lang.Object
com.liferay.petra.lang.ClassLoaderPool
Maps servlet context names to/from the servlet context's class loader.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ClassLoadergetClassLoader(String contextName) Returns the class loader associated with the context name.static StringgetContextName(ClassLoader classLoader) Returns the context name associated with the class loader.static voidregister(String contextName, ClassLoader classLoader) static voidunregister(ClassLoader classLoader) static voidunregister(String contextName)
-
Constructor Details
-
ClassLoaderPool
public ClassLoaderPool()
-
-
Method Details
-
getClassLoader
Returns the class loader associated with the context name.If no class loader is found for the context name, the thread's context class loader is returned as a fallback.
- Parameters:
contextName- the servlet context's name- Returns:
- the class loader associated with the context name
-
getContextName
Returns the context name associated with the class loader.If the class loader is
nullor if no context name is associated with the class loader, {@link <code>"null"</code>} is returned.- Parameters:
classLoader- the class loader- Returns:
- the context name associated with the class loader
-
register
-
unregister
-
unregister
-