File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
jetcache-core/src/main/java/com/alicp/jetcache/support Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ public class JetCacheExecutor {
17
17
protected volatile static ScheduledExecutorService heavyIOExecutor ;
18
18
private static final ReentrantLock reentrantLock = new ReentrantLock ();
19
19
20
- private static AtomicInteger threadCount = new AtomicInteger (0 );
20
+ private static final AtomicInteger threadCount = new AtomicInteger (0 );
21
21
22
22
static {
23
23
Runtime .getRuntime ().addShutdownHook (new Thread () {
@@ -73,6 +73,13 @@ public static ScheduledExecutorService heavyIOExecutor() {
73
73
ThreadFactory tf = r -> {
74
74
Thread t = new Thread (r , "JetCacheHeavyIOExecutor" + threadCount .getAndIncrement ());
75
75
t .setDaemon (true );
76
+ ClassLoader classLoader = JetCacheExecutor .class .getClassLoader ();
77
+ if (classLoader == null ) {
78
+ // This class was loaded by the Bootstrap ClassLoader,
79
+ // so let's tie the thread's context ClassLoader to the System ClassLoader instead.
80
+ classLoader = ClassLoader .getSystemClassLoader ();
81
+ }
82
+ t .setContextClassLoader (classLoader );
76
83
return t ;
77
84
};
78
85
heavyIOExecutor = new ScheduledThreadPoolExecutor (
You can’t perform that action at this time.
0 commit comments