Thanks a lot. Your support is great and appropriate, as usual. I still think there's something wrong with this topic, but more on the Java 8 side. I'll do some more investigations and, in case, involve them!
--fb On Fri, Mar 24, 2017 at 8:05 PM, Mark Thomas <ma...@apache.org> wrote: > On 24 March 2017 17:51:27 GMT+00:00, Francesco Bassi <fvba...@gmail.com> > wrote: > >Hello. > >I have a weird problem that happens only wih tomcat 9.0.0-M17+: > > > >- I need to process a parallel java stream inside a custom ForkJoinPool > > > >If I run the code with 9.0.0-M15, I see that all the threads are > >properly > >created using my factory. > > > >If I run the code with 9.0.0-M17+, some of the threads that are used in > >the > >Stream processing are not coming from my factory, but instead are > >instance > >of > >org.apache.catalina.startup.SafeForkJoinWorkerThreadFactor > y$SafeForkJoinWorkerThread. > > > > > >Sample prototype code: > > > > ForkJoinPool pool = new ForkJoinPool(2, p -> new > >MyForkJoinWorkerThread(p), null, false); > > pool.submit(() -> { > > Stream<T> stream = createMyStream(); > > return stream.parallel().map(t -> { > > System.out.println("THREAD: " + > >Thread.currentThread().getClass()); > > return t; > > }).collect(Collectors.toArrayList()); > > }).get(); > > > > > >It seems that something from the newer tomcats "interferes" with the > >ForkJoinPool mechanism in some weird way. > >Can someone help me to understand what's going on? > > > http://tomcat.apache.org/tomcat-9.0-doc/config/listeners.html#JRE_Memory_ > Leak_Prevention_Listener_-_org.apache.catalina.core. > JreMemoryLeakPreventionListener > > Look for forkJoinCommonPoolProtection > > Mark > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >