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.SafeForkJoinWorkerThreadFactory$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