JSR 236 ("Concurrency Utilities for JavaTM EE") defines means of managing executor services as container resources and obtaining such ManagedExecutorService objects from JNDI or via dependency injection. This JSR is part of Java EE 7 and thus available in WildFly and other compatible containers. We should investigate how to leverage this facility, falling back to the current implementation if not applicable.
If successful, the same can be done for the mass indexer in OGM.
Playing the devil's advocate. What's the use case / optimization ?
The use case is to allow the container to manage the internal threads; for example it is supposed to be easier to feed performance information to management tooling.