A work manager acts as a managed executor (thread pool), thread factory, and thread
context service for application components that use Concurrency Utilities for Java™ EE or asynchronous beans. Use the administrative console to configure
work managers.
Before you begin
If you are not familiar with work managers, refer to the Work managers conceptual topic.
About this task
The work manager service is always enabled. In previous versions of the product, the work manager
service could be disabled using the administration console or configuration service. The work
manager service configuration objects are still present in the configuration service, but the
enabled attribute is ignored.
You can define multiple work managers for each cell. Each work manager is bound to a unique place
in the Java Naming and Directory Interface (JNDI)
namespace.
Important: The work manager service is only supported from within the Enterprise JavaBeans (EJB) container or web container. Looking up and using a
configured work manager from a Java Platform, Enterprise Edition (Java EE) application client
container is not supported.
Procedure
- Start the administrative console.
- Select .
- Specify a Scope value and click New.
- Specify the required properties for work manager settings.
- Scope
- The scope of the configured resource. This value indicates the location for the configuration
file.
- Name
- The display name for the work manager.
- JNDI Name
- The Java Naming and Directory Interface (JNDI) name for the work manager. Resource environment
references can be bound to this name and used by components that must look up the work manager. Each
work manager must have a unique JNDI name within the cell.
- Number of Alarm Threads
- The maximum number of threads to use for a separate thread pool that is dedicated to processing
alarms and work scheduled to run at a specific point in time. The work manager monitors and
dispatches pending alarms and scheduled work to this thread pool.
Note: The number of
alarm threads that you specify for this property has no impact on the number of threads you specify
for the Minimum Number Of Threads and Maximum Number Of Threads properties. The Number of Alarm
Threads property only applies to the thread pool for alarm threads. The Minimum Number Of Threads
and Maximum Number Of Threads properties only apply to the main thread pool that handles work
requests.
- Minimum Number Of Threads
- Applies to the main thread pool for work submitted to the work manager to run immediately (not
scheduled for a specific point in time). The number of threads to be kept in the thread pool,
created as needed.
- Maximum Number Of Threads
Note: Applies to the main thread pool for work submitted to the work manager to
run immediately (not scheduled for a specific point in time). The maximum number of threads to be
created in the thread pool. The maximum number of threads can be exceeded temporarily when the
Growable check box is selected. These additional threads are discarded when the work on the thread
completes.
- Thread Priority
- The priority to assign to all threads in the thread pool and all threads created by the managed
thread factory.
Every thread has a priority. Threads with higher priority are run before threads
with lower priority. For more information about how thread priorities are used, see the Javadoc for
the setPriority method of the java.lang.Thread class in the Java Standard Edition specification.
- [Optional] Specify a Description and a Category for the work manager.
- [Optional] Select the Service Names (types of thread context made available to Java EE
components) that you want this work manager to capture from the submitting thread (or from the
thread that looks up or injects the managed thread factory) and to make available on the thread of
execution. The list of selected services also is known as the "sticky" context policy for the work
manager.
Selecting more services than are required might impede performance.
- [Optional] Select Custom Properties > New. Other optional fields include:
- Name
- lateWorkTime
- Value
- Number of seconds
- Description
- Specify a description
- Type
- Select java.lang.String
The lateWorkTime custom property is the number of seconds beyond which late-starting work
must cause an informational message to be logged. The informational message is logged once per work
manager. The default value is 60 seconds and a value of 0 disables this property.
- Name
- lateAlarmTime
- Value
- Number of seconds
- Description
- Specify a description
- Type
- Select java.lang.String
The lateAlarmTime custom property is the number of seconds beyond which a late-firing alarm
must cause an informational message to be logged. The informational message is logged once per work
manager. The default value is 5 seconds and a value of 0 disables this property.
- Save your configuration.
Results
The work manager is now configured and ready for access by application components that must
manage the start of asynchronous code.