Configuring server managed ExecutorService instances

You can configure application server managed ExecutorService instances to run asynchronous tasks with the specified context. It is a best practice for Java™ EE applications to avoid directly managing their own threads; therefore, the managed ExecutorService extends the JSE Executor to provide a way to execute asynchronous tasks within an application server environment. You might also configure the managed Executor Service to propagate various contexts that are relevant to Java EE applications to the thread of the asynchronous task.

Fix Pack 8550

About this task

The managed ExecutorService is available under the <concurrent-1.0> feature and enabled in the server.xml file as follows:
<featureManager>
	<feature>concurrent-1.0</feature>
</featureManager>
Propagation of context to the thread of a task that is executed by the managed ExecutorService is managed by the context service. A default instance of the context service (DefaultContextService) is created by the server and configured to propagate at least classLoaderContext, jeeMetadataContext and securityContext. It is possible that additional context types might be propagated by default if a custom context provider is configured accordingly. This default context service instance is used if a managed ExecutorService is created without referring to a specific context service instance or configuring a context service instance directly within. Context service instances might be configured to inherit the configuration of another context service instance using the baseContextRef attribute. You can configure context propagation to include the following types of context:
classloaderContext
Makes the thread context classloader of the submitter of the task available to the task.
jeeMetadataContext
Makes the namespace of the application component that submitted the task available to the task.
securityContext
Makes the caller subject and invocation subject of the submitter of the task available to the task.

Procedure

Example configuration in the server.xml file:

Example

Managed executor serviced instances can be injected into application components (by using @Resource) or looked up with resource environment references (resource-env-ref):


Icon that indicates the type of topic Task topic

Terms and conditions for information centers | Feedback


Timestamp icon Last updated: Wednesday, 22 May 2013
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-nd-mp&topic=twlp_config_managedexecutor
File name: twlp_config_managedexecutor.html