Clear context class loader from started threads

This commit is contained in:
Lauri Tulmin 2025-07-14 16:19:24 +03:00
parent 80094155e9
commit 41415e5115
No known key found for this signature in database
GPG Key ID: FD1C4A546B329375
3 changed files with 3 additions and 0 deletions

View File

@ -252,6 +252,7 @@ final class StrictContextStorage implements ContextStorage, AutoCloseable {
thread.setName("weak-ref-cleaner-strictcontextstorage"); thread.setName("weak-ref-cleaner-strictcontextstorage");
thread.setPriority(Thread.MIN_PRIORITY); thread.setPriority(Thread.MIN_PRIORITY);
thread.setDaemon(true); thread.setDaemon(true);
thread.setContextClassLoader(null);
thread.start(); thread.start();
} }

View File

@ -87,6 +87,7 @@ public final class LeakDetectingSpanProcessor implements SpanProcessor {
thread.setName("weak-ref-cleaner-leakingspandetector"); thread.setName("weak-ref-cleaner-leakingspandetector");
thread.setPriority(Thread.MIN_PRIORITY); thread.setPriority(Thread.MIN_PRIORITY);
thread.setDaemon(true); thread.setDaemon(true);
thread.setContextClassLoader(null);
thread.start(); thread.start();
return pendingSpans; return pendingSpans;
} }

View File

@ -48,6 +48,7 @@ public final class DaemonThreadFactory implements ThreadFactory {
try { try {
t.setDaemon(true); t.setDaemon(true);
t.setName(namePrefix + "-" + counter.incrementAndGet()); t.setName(namePrefix + "-" + counter.incrementAndGet());
t.setContextClassLoader(null);
} catch (SecurityException e) { } catch (SecurityException e) {
// Well, we tried. // Well, we tried.
} }