我们在wildfly10的standalone-full.xml中有以下配置。
<subsystem xmlns="urn:jboss:domain:ejb3:4.0">
<session-bean>
<stateless>
<bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
</stateless>
<stateful default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/>
<singleton default-access-timeout="5000"/>
</session-bean>
<mdb>
<resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-ra.rar}"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
<pools>
<bean-instance-pools>
<strict-max-pool name="slsb-strict-max-pool" derive-size="from-worker-pools" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
<strict-max-pool name="mdb-strict-max-pool" derive-size="from-cpu-count" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
<strict-max-pool name="ExchangeMessagePool" max-pool-size="10" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
</bean-instance-pools>
</pools>
</subsystem>
我们有以下消息驱动bean与交换消息池链接。在standalone-full.xml中,我们将max-pool-size设置为10,但在服务器启动期间创建的实例数为30但是我不知道它来自哪里。我们有什么办法可以限制它。如果有任何方法可以限制在独立完整文件中访问这个bean的并发线程数。
@MessageDriven(name = "ExchangeMessage", activationConfig = {@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/queue/ExchangeMessageQueue")})
@PermitAll
@Pool("ExchangeMessagePool")
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
@TransactionManagement(TransactionManagementType.CONTAINER)
public class ExchangeMessageBean implements MessageListener
{
...
}
答案 0 :(得分:0)
如果你没有指定@ResourceAdapter,它会使用默认的pooled-connection-factory命名为&#34; activemq-ra&#34;它有自己的默认值,并且除了指定的池之外还使用它的默认值(我认为是15),或两者都使用。您可以使用maxSessions =&#34; n&#34;来注释MDB。这会将并行实例的数量限制为n。