在基于 Websphere 的应用程序中实现并发
Implementing concurrency in Websphere based application
我们正在开发部署在 Websphere Web 服务器上的 Java EE Web 应用程序。目前有并发执行加速响应时间的需求。那么在以下选择中,哪个以及为什么会是更好的选择?
- 使用
ExecutorService
- 使用
Managed Executor Service
(以上两种方法的基本用法和实现区别是什么)
- 还有其他选择吗?
ManagedExecutorService 的 javadoc 非常清楚地说明了区别:
A ManagedExecutorService extends the Java™ SE ExecutorService to
provide methods for submitting tasks for execution in a Java™ EE
environment. Implementations of the ManagedExecutorService are
provided by a Java™ EE Product Provider. Application Component
Providers use the Java Naming and Directory Interface™ (JNDI) to
look-up instances of one or more ManagedExecutorService objects using
resource environment references. ManagedExecutorService instances can
also be injected into application components through the use of the
Resource annotation.
您应该只使用规范定义的 EE 并发实用程序(包括 ManagedExecutor)。
我们正在开发部署在 Websphere Web 服务器上的 Java EE Web 应用程序。目前有并发执行加速响应时间的需求。那么在以下选择中,哪个以及为什么会是更好的选择?
- 使用
ExecutorService
- 使用
Managed Executor Service
(以上两种方法的基本用法和实现区别是什么) - 还有其他选择吗?
ManagedExecutorService 的 javadoc 非常清楚地说明了区别:
A ManagedExecutorService extends the Java™ SE ExecutorService to provide methods for submitting tasks for execution in a Java™ EE environment. Implementations of the ManagedExecutorService are provided by a Java™ EE Product Provider. Application Component Providers use the Java Naming and Directory Interface™ (JNDI) to look-up instances of one or more ManagedExecutorService objects using resource environment references. ManagedExecutorService instances can also be injected into application components through the use of the Resource annotation.
您应该只使用规范定义的 EE 并发实用程序(包括 ManagedExecutor)。