aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/runtime/Desc.java
diff options
context:
space:
mode:
authorShigeru Chiba <chibash@users.noreply.github.com>2019-03-17 22:26:08 +0900
committerGitHub <noreply@github.com>2019-03-17 22:26:08 +0900
commit50430c10beedcc5971ed63c12810f1c13f1c33a5 (patch)
treedc4a6792f66fd6db05d814c819510186d98a04c5 /src/main/javassist/runtime/Desc.java
parenteff2f4bbd0246476edfa43782f38e58ddedef952 (diff)
parentf1e12688218e3f47574946ccddbb8402798e3540 (diff)
downloadjavassist-50430c10beedcc5971ed63c12810f1c13f1c33a5.tar.gz
javassist-50430c10beedcc5971ed63c12810f1c13f1c33a5.zip
Merge pull request #250 from skybber/master
Control ctxClassLoader usage per thread
Diffstat (limited to 'src/main/javassist/runtime/Desc.java')
-rw-r--r--src/main/javassist/runtime/Desc.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/javassist/runtime/Desc.java b/src/main/javassist/runtime/Desc.java
index c733b30d..9fbe8f22 100644
--- a/src/main/javassist/runtime/Desc.java
+++ b/src/main/javassist/runtime/Desc.java
@@ -34,10 +34,25 @@ public class Desc {
*/
public static boolean useContextClassLoader = false;
+ private static final ThreadLocal<Boolean> USE_CONTEXT_CLASS_LOADER_LOCALLY = new ThreadLocal<Boolean>() {
+ @Override
+ protected Boolean initialValue() {
+ return false;
+ }
+ };
+
+ public static void setUseContextClassLoaderLocally() {
+ USE_CONTEXT_CLASS_LOADER_LOCALLY.set(true);
+ }
+
+ public static void resetUseContextClassLoaderLocally() {
+ USE_CONTEXT_CLASS_LOADER_LOCALLY.remove();
+ }
+
private static Class<?> getClassObject(String name)
throws ClassNotFoundException
{
- if (useContextClassLoader)
+ if (useContextClassLoader || USE_CONTEXT_CLASS_LOADER_LOCALLY.get())
return Class.forName(name, true, Thread.currentThread().getContextClassLoader());
return Class.forName(name);
}