Package sonia.scm.util
Class ClassLoaders
java.lang.Object
sonia.scm.util.ClassLoaders
Util methods for
ClassLoader
s.- Since:
- 1.37
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
executeInContext
(ClassLoader classLoader, Runnable runnable) Executes aRunnable
with the givenClassLoader
as context ClassLoader (Thread.setContextClassLoader(ClassLoader)
).static ClassLoader
getContextClassLoader
(Class<?> contextClass) Returns the contextClassLoader
from the currentThread
, if the contextClassLoader
is not available theClassLoader
, which has load the given context class, is used.
-
Method Details
-
executeInContext
Executes aRunnable
with the givenClassLoader
as context ClassLoader (Thread.setContextClassLoader(ClassLoader)
).- Parameters:
classLoader
- ClassLoader for contextrunnable
- runnable- Since:
- 2.0.0
-
getContextClassLoader
Returns the contextClassLoader
from the currentThread
, if the contextClassLoader
is not available theClassLoader
, which has load the given context class, is used.- Parameters:
contextClass
- context class- Returns:
- context class loader
-