Class ClassLoaderThreadFactory

  • All Implemented Interfaces:
    java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory

    public class ClassLoaderThreadFactory
    extends java.lang.Object
    implements java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory
    see https://stackoverflow.com/a/59444016/6500859 Java 11 fix for the class loader and ClassNotFoundExceptions problems. Before jdk9 ForkJoinPool.common() returns an Executor with a ClassLoader of your main Thread, in Java 9 this behave changes, and return an executor with the system jdk system classloader. So it's easy to find ClassNotFoundExceptions inside CompletableFutures code while upgrading from Java 8 to Java 9 / 10 / 11, due to this change.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.concurrent.ForkJoinWorkerThread newThread​(java.util.concurrent.ForkJoinPool pool)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ClassLoaderThreadFactory

        public ClassLoaderThreadFactory()
    • Method Detail

      • newThread

        public final java.util.concurrent.ForkJoinWorkerThread newThread​(java.util.concurrent.ForkJoinPool pool)
        Specified by:
        newThread in interface java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory