Java Reference
In-Depth Information
Component
Description
The interface extends the standard ScheduleExecutorService , but it additionally
provides the Trigger feature; the possibility to create a dynamic object, which can decide when
a specific event should be fired (see javax.enterprise.concurrent.Trigger ).
This is used to capture the context of the container; it can then be used while submitting a job to
the executor service.
ContextService
This is used to create threads by the container. The developer can provide its own thread factory
in order to fulfil specific use cases (for instance, setting specific properties on the created ob-
jects).
ManagedThreadFactory
Instances of these components can be obtained using the JNDI lookup or the @Re-
source injection. The Java EE 7 specification requires that every container provides a
set of default resources that should be injectable without any additional configuration. So,
in WildFly, the easiest way to get your hands on them would be to just type the following
code:
@Resource
private ManagedExecutorService executorService;
@Resource
private ManagedScheduledExecutorService
scheduledExecutorService;
@Resource
private ContextService contextService;
The aforementioned code snippet is shorthand for a lookup of the default instances, which
are as follows:
@Resource(lookup="java:comp/DefaultManagedExecutorService")
private ManagedExecutorService executorService;
You can also find any additional executor services and the configuration of the default
ones in the standalone.xml file (and in other variants of the configuration file). A
part of the relevant subsystem is presented as follows:
Search WWH ::




Custom Search