Package hudson.util

Class ClassLoaderSanityThreadFactory

java.lang.Object
hudson.util.ClassLoaderSanityThreadFactory
All Implemented Interfaces:
ThreadFactory

public class ClassLoaderSanityThreadFactory extends Object implements ThreadFactory
Explicitly sets the Thread.setContextClassLoader(java.lang.ClassLoader) for threads it creates to its own classloader. This avoids issues where threads are lazily created (ex by invoking ScheduledExecutorService.schedule(Runnable, long, TimeUnit)) in a context where they would receive a customized Thread.getContextClassLoader() that was never meant to be used. Commonly this is a problem for Groovy use, where this may result in memory leaks.
Since:
2.105
See Also: