[英]Assign a pool to a specific stateless bean in JBoss EAP 6.1
I can see how one can control the size of the global pool for all the stateless session beans. 我可以看到如何控制所有无状态会话bean的全局池大小。
However, I would like to be able to have a new pool that only applies to one type of stateless bean. 但是,我希望能够有一个仅适用于一种类型的无状态Bean的新池。 This way, all my stateless beans but one would be pooled from the usual
slsb-strict-max-pool
, and one bean would have its own pool. 这样,我所有的无状态bean(只有一个)将从通常的
slsb-strict-max-pool
,一个bean将拥有自己的池。
Is it possible to do that in JBoss EAP 6.1? 在JBoss EAP 6.1中可以做到吗?
Use 采用
@org.jboss.ejb3.annotation.Pool(value="myPoolName")
annotation on the EJB referencing your custom pool as defined in the standalone.xml : EJB上的注释,该注释引用了standalone.xml中定义的定制池:
<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="80" instance-acquisition-timeout="1"
instance-acquisition-timeout-unit="MINUTES" />
<strict-max-pool name="myPoolName"
max-pool-size="20" instance-acquisition-timeout="5"
instance-acquisition-timeout-unit="SECONDS" />
</bean-instance-pools>
</pools>
[ edit ] without the annotation : [ 编辑 ]不带注释:
Using the pool namespace (urn:ejb-pool:1.0) in jboss-ejb3.xml (jboss specific ejb descriptor) 在jboss-ejb3.xml(jboss特定的ejb描述符)中使用池名称空间(urn:ejb-pool:1.0)
<p:pool>
<ejb-name>myEjbName</ejb-name>
<p:bean-instance-pool-ref>myPoolName</p:bean-instance-pool-ref>
</p:pool>
Finally, it seems you also have to configure the 'maxSession' activation configuration property accordingly in your MDB. 最后,看来您还必须在MDB中相应地配置“ maxSession”激活配置属性。 Default maxSession value is 15. https://docs.jboss.org/ejb3/docs/tutorial/1.0.7/html/Message_Driven_Beans.html
默认maxSession值为15 https://docs.jboss.org/ejb3/docs/tutorial/1.0.7/html/Message_Driven_Beans.html
Eg 例如
<message-driven>
<ejb-name>myMDB</ejb-name>
<activation-config>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>java:jboss/queue/test/myMDBQueue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>maxSession</activation-config-property-name>
<activation-config-property-value>20</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.