Network Deployment (Distributed operating systems), v8.0 > Applications > Spring applications > Spring Framework


Thread management and the Spring Framework

Use the information in the following sections to avoid potential problems with unmanaged threads.


Unmanaged threads

Do not use a scenario that can create unmanaged threads, for the following reasons:

The following scenarios are examples of Spring Framework scenarios to avoid:


Thread pooling

WAS supports the use of the Spring Framework WorkManagerTaskExecutor class to run work asynchronously.

The WorkManagerTaskExecutor class uses thread pools that are managed by the application server, and delegates to a configured WorkManager instance. For information about configuring a work manager, see the related topics.

Do not use other TaskExecutor classes that are provided with the Spring Framework, because they might start unmanaged threads.

We can use the JNDI name of the configured work manager as a workManagerName property to define a WorkManagerTaskExecutor instance in the Spring configuration file. Use the JNDI name of the DefaultWorkManager in the application server, that is, wm/default:

<bean id="myTaskExecutor"
  class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor">
<property name="workManagerName" value="wm/default" />
</bean>


Schedule

We can use the CommonJ WorkManager scheduling package in the Spring Framework to work with threads that are managed by the application server. Avoid using other packages, such as the Quartz scheduler, or the Timer in the Java SE Development Kit (JDK), because they can start unmanaged threads.
Spring Framework
Configure work managers
Spring Documentation Concept topic

+

Search Tips   |   Advanced Search