【问题标题】:Does the default Managed Executor Service use the same thread pool used by the general application in Wildfly?默认的 Managed Executor Service 是否使用 Wildfly 中通用应用程序使用的相同线程池?
【发布时间】:2025-09-21 02:40:02
【问题描述】:

我在 Wildfy 21 上部署的 JavaEE Web 应用程序中使用托管执行器服务。目标是在其他线程中执行长时间定时任务,以释放服务器使用的线程来响应客户端的请求(HTTP 请求)。

我使用的是 Wildfly 中配置的默认执行器服务:

@Resource(lookup = "java:jboss/ee/concurrency/executor/default")
public void setExecutorService(ManagedExecutorService executorService) {
    this.executorService = executorService;
}

默认托管执行器服务是否使用用于处理 HTTP 请求的同一线程池?还是 Widfly 创建了一个新的线程池供 Managed Executor Service 使用?

我阅读了 Widlfy documentation,但没有找到答案。

【问题讨论】:

    标签: java multithreading wildfly


    【解决方案1】:

    不,它没有。

    Managed Executor Service 使用的线程池与用于处理 HTTP 请求的线程池不同。

    HTTP 请求由 Web (Undertow) 子系统处理,该子系统使用 Worker 中定义的线程。

    另一方面,Managed Executor Service 有自己的线程配置

    http://www.mastertheboss.com/jboss-web/jbosswebserver/using-a-custom-thread-pool-for-web-applications-running-on-wildfly

    【讨论】:

      最近更新 更多