Unfortunately JSR-236 does not address Java 7 fork/join pools. This puts people how want to use fork/join pools in an awkward position, either don't use them and wait for EE 8 (four or five years) or violate the "contract" and just create them anyway.
This presents a great opportunity for AS8 to go further than the spec and provide a java.util.concurrent.ForkJoinPool and a java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory. This allows us to innovate and standardize at a later time in EE 8 once we gained experience.
This should include the following features:
- Allow the configuration of java.util.concurrent.ForkJoinPool in the server configuration. You should be able to configure the parallelism and asyncMode (see constructor arguments). Similar to javax.enterprise.concurrent.ManagedExecutorService.
- Allow the injection of java.util.concurrent.ForkJoinPool configured in the server. Similar to javax.enterprise.concurrent.ManagedExecutorService.
- Allow the configuration of java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory in the server configuration, merely to match the same feature in JSR-268.
- Allow the injection of java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory configured in the server (similar to Infinispan), merely to match the same feature in JSR-268.
- java.util.concurrent.ForkJoinPool should per default not preserve the context http://java.net/projects/concurrency-ee-spec/lists/jsr236-experts/archive/2013-02/message/10 (naming, security, transactions, class loading). Optionally you should be able to configure which contexts are preserved, this might be tough as ForkJoinPool is not designed for extensibility.
I'm well aware that this is unspecified behaviour but so is Infinispan in AS7 and AS8 since JSR-107 again didn't make it.
This issue is intended for AS8, not AS7.