users@javaee-spec.java.net

[javaee-spec users] Use of new Java 8 API which uses threading

From: Ondrej Mihályi <ondrej.mihalyi_at_gmail.com>
Date: Thu, 16 Jun 2016 08:38:04 +0200

Hi,

I'd like to ask whether there are any plans to align Java EE environment
with new threading features in Java 8? Specifically the functionality which
uses ForkJoinPool, like parallel streams and CompletableFuture?

I suggest that Java EE 8 specify that the new Java 8 features don't use
ForkJoinPool in Java EE environment. The simplest solution would be to
fallback to using the current thread instead. Even better would be to use a
managed executor wherever ForkJoinPool is used by default Java 8
functionality.

I already investigated how to implement this, and the solution would most
probably require an alternative implementation of some standard classes and
putting them to bootstrap classpath. Current Java 8 API does not provide
sufficient means to change the default behavior. Although, at least for
CompletableFuture, it seems possible to create a descendant class, which
would force using specific executor by default. But that would be a
different API -> not so error-prone from developer point of view, and also
not solving running legacy parallel code in Java EE.

Is this a good place to discuss? Or is it better to move the discussion to
the Concurrency mailing list? The Concurrency JSR has been pretty inactive
for a long time (last message in mailing list is more than a year old),
therefore I'm asking here.

Cheers,
Ondrej Mihályi