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 ClassLoader
getClassLoader
(String contextName) Returns the class loader associated with the context name.static String
getContextName
(ClassLoader classLoader) Returns the context name associated with the class loader.static void
register
(String contextName, ClassLoader classLoader) static void
unregister
(ClassLoader classLoader) static void
unregister
(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
null
or 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
-