gpt4 book ai didi

ejb - 如何解决 - JBAS014516 : Failed to acquire a permit within 5 MINUTES

转载 作者:行者123 更新时间:2023-12-02 06:41:39 24 4
gpt4 key购买 nike

我的 EJB-JBOSS 配置目前面临“JBAS014516:无法在 5 分钟内获取许可”问题。以下是我的配置 -

<subsystem xmlns="urn:jboss:domain:ejb3:1.4">
<session-bean>
<stateless>
<bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
</stateless>
<stateful default-access-timeout="5000" cache-ref="simple"/>
<singleton default-access-timeout="5000"/>
</session-bean>
<mdb>
<resource-adapter-ref resource-adapter-name="hornetq-ra"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
<pools>
<bean-instance-pools>
<strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
<strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
</bean-instance-pools>
</pools>
<caches>
<cache name="simple" aliases="NoPassivationCache"/>
<cache name="passivating" passivation-store-ref="file" aliases="SimpleStatefulCache"/>
<cache name="clustered" passivation-store-ref="abc" aliases="StatefulTreeCache"/>
</caches>

<async thread-pool-name="default"/>
<timer-service thread-pool-name="default">
<data-store path="timer-service-data" relative-to="jboss.server.data.dir"/>
</timer-service>
<remote connector-ref="remoting-connector" thread-pool-name="default"/>
<thread-pools>
<thread-pool name="default">
<max-threads count="10"/>
<keepalive-time time="100" unit="milliseconds"/>
</thread-pool>
</thread-pools>
<iiop enable-by-default="false" use-qualified-name="false"/>
<default-security-domain value="other"/>
<default-missing-method-permissions-deny-access value="true"/>
</subsystem>

要解决此问题,我应该将“strict-max-pool”增加到更高的值或增加线程池大小。

最佳答案

在不了解您的用例的情况下,很难提出一个好的方法,但很可能您正在 EJB bean 上调用一个方法,该方法执行时间太长,逐渐耗尽池中的实例,直到没有剩余的实例对于调用者进程。随着对此操作的请求越来越多,EJB 容器将尝试为客户端提供池中的下一个空闲项。通常,如果对 bean 实例的操作完成,该实例将返回到池中并可用于下一次客户端调用。如果操作需要很长时间,池将耗尽,直到没有可用的实例来服务客户端调用。根据您的配置,EJB 容器有 20 个实例;如果没有可用的实例,它将尝试等待 5 分钟,以确定是否有实例不会返回到池中。如果未能及时获取实例,则会向调用者抛出上述错误。
那么这将我们引向何方:首先也是最重要的分析花费这么长时间的 EJB 操作(向您的部署添加一个简单的 EJB 拦截器非常有用,它可以跟踪 EJB 调用的开始和结束以及跟踪执行时间)
确定谁调用该 EJB 实例 - 也许它对该 bean 进行了过多的调用。
如果无法避免或优化长时间运行的操作,请增加池大小,以便客户端可以使用该 bean 的更多实例(调整 max-pool-size)

如果您的用例需要长时间运行的操作,但不需要阻塞并等待其结果,请考虑与 JMS 队列一起进行异步处理 - 在队列中创建作业,然后使用 MDB 执行它们。您仍然可以通过数据库存储和查询处理状态。

关于ejb - 如何解决 - JBAS014516 : Failed to acquire a permit within 5 MINUTES,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44321590/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com