winflex

Results 3 comments of winflex

turns out that the ForJoinPool.commonPool's thread doesn't have the same context classloader as the thread which invokes CompletableFuture.xxxAsync() still don't know the solution

Tried to customize my own ForkJoinPoolThreadFactory, and set by -Djava.util.concurrent.ForkJoinPool.common.threadFactory=MyFactory But it's not working in a spring boot application bacause ForkJoinPool uses AppClassLoader(returned by ClassLoader.getSystemClassLoader()) to load the MyFactory.class and...

> 我觉得你可以用supplyAsync(Supplier supplier,Executor executor)这个解决,自定义一个Executor来处理。 > 要么就是监听SpringApplicationEvent的各种事件,在监听处代码把ForkJoinPool.common.threadFactory这个final属性修改成自己的MyFactory 两种都考虑过,我就想问问有没有更优雅的方式