[cdi-dev] [JBoss JIRA] (CDI-710) Require default event ExecutorService to be managed on Java EE

Romain Manni-Bucau (JIRA) issues at jboss.org
Mon Aug 14 08:50:01 EDT 2017

    [ https://issues.jboss.org/browse/CDI-710?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13448442#comment-13448442 ] 

Romain Manni-Bucau commented on CDI-710:

* we don't have any "exact numbers" about expectations and usage
* CDI 2 is also targeted to other environments, not only Java EE

Well this API hurts in most cases:

- EE (this ticket)
- standalone: if you use that as a bus backbone you need a custom pool, if you use it in a lib then you need a custom pool to ensure you can integrate in any app and don't get any contention between the users of that API and that you can scale, if you use it in an application relying on the bus at runtime then you need to ensure you control it, don't lock it and can tune it. Only case you can use a default executor is when you don't care at all of the behavior of the application in that area which is likely either a very rare user of that API or a completely "offline" application (like a daemon or batch).

Issue is really unrelated to EE but to the lack of expectation in term of runtime and the merge of all the asynchronism usages in a single pool (which can lead to locks BTW if the pool is a fixed sized one with a size of queue > 0). This doesn't sound safe enough to be encourage and I don't think it can be solved at stack level since it depends too much the consumer so we should be able to either let the application modify the default executor itself very easily (through an extension or supporting to override it with a Bean) or we should probably deprecate this abusive API.

> Require default event ExecutorService to be managed on Java EE
> --------------------------------------------------------------
>                 Key: CDI-710
>                 URL: https://issues.jboss.org/browse/CDI-710
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Events
>            Reporter: Guillermo González de Agüero
> When running on a Java EE environment, CDI should use a managed executor service by default for asynchronous operations.
> This is already required by the JAX-RS 2.1 spec (http://download.oracle.com/otndocs/jcp/jaxrs-2_1-pfd-spec/index.html), section 5.8:
> {quote}In an environment that supports the Concurrency Utilities for Java EE [13], such as the Java EE Full Profile, implementations MUST use ManagedExecutorService and ManagedScheduledExecutorService, respectively. The reader is referred to the Javadoc of ClientBuilder for more information about executor services.{quote}
> Containers will presumably offer monitoring features and thread pool configuration options for managed executor services.

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list