【问题标题】:bounded-queue-thread-pool threads not getting terminated on jboss shutdown有界队列线程池线程未在 jboss 关闭时终止
【发布时间】:2014-11-04 06:15:15
【问题描述】:

我在 Jboss 7.2.0 Standalone.xml 中创建了一个有界队列线程池,如下所示:

<subsystem xmlns="urn:jboss:domain:threads:1.1">
    <bounded-queue-thread-pool name="myThreadPool">
    <core-threads count="6000"/>
    <queue-length count="1000"/>
    <max-threads count="6000"/>
    <keepalive-time time="60" unit="seconds"/>
    </bounded-queue-thread-pool>
</subsystem>

之后我在 AJP 连接器中使用它作为执行器,如下所示:

<connector name="conn1" protocol="AJP/1.3" scheme="http" socket-binding="conn1" enabled="true" max-post-size="0" executor="myThreadPool" max-connections="2000"/>
<connector name="conn2" protocol="AJP/1.3" scheme="http" socket-binding="conn2" enabled="true" executor="myThreadPool" max-connections="2000"/>
<connector name="conn3" protocol="AJP/1.3" scheme="http" socket-binding="conn3" enabled="true" executor="myThreadPool" max-connections="2000"/>

最后是 3 个连接器的套接字绑定:

<socket-binding name="conn1" port="15007"/>
<socket-binding name="conn2" port="15008"/>
<socket-binding name="conn3" port="15009"/>

当我启动 jboss 并创建多个 http 请求时,每个请求线程都创建为 myThreadPool-threads-1myThreadPool-threads-2 等。但是当我使用命令行关闭 jboss 时,这些线程并没有被终止。这是我用来关机的命令:

%JBOSS_HOME%\bin\jboss-cli.bat --connect controller=10.10.54.85:9999 --commands=:shutdown

因此,jboss-AS 的 java 进程没有被杀死。但是,当我简单地从connector 中删除executor 时,java 进程将成功终止。有人可以建议我在服务器关闭时如何终止线程池的所有线程吗?

【问题讨论】:

    标签: jboss jboss7.x threadpool


    【解决方案1】:

    可能this bug 是您的问题的原因,已设置解决方法:

    org.apache.coyote.ajp.DEFAULT_CONNECTION_TIMEOUT
    

    在您的host.xmlstandalone.xmldomain.xml 中将以下内容添加到您的system-properties

    <system-properties>
        <property name="org.apache.coyote.ajp.DEFAULT_CONNECTION_TIMEOUT" value="600000"/>
    <system-properties>
    

    除非我们不断向服务器发送请求,否则此方法有效。

    另见:server hang during shutdown when specifying executor in connector

    【讨论】:

      猜你喜欢
      • 2023-03-18
      • 1970-01-01
      • 2019-06-25
      • 1970-01-01
      • 1970-01-01
      • 2020-11-19
      • 2023-02-20
      • 2010-11-15
      • 2011-04-28
      相关资源
      最近更新 更多