Assign a pool to a specific stateless bean in JBoss EAP 6.1

ぃ、小莉子 提交于 2019-12-24 00:22:58

问题


I can see how one can control the size of the global pool for all the stateless session beans.

However, I would like to be able to have a new pool that only applies to one type of stateless 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.

Is it possible to do that in JBoss EAP 6.1?


回答1:


Use

@org.jboss.ejb3.annotation.Pool(value="myPoolName")

annotation on the EJB referencing your custom pool as defined in the 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)

<p:pool>
 <ejb-name>myEjbName</ejb-name>
 <p:bean-instance-pool-ref>myPoolName</p:bean-instance-pool-ref>
</p:pool>



回答2:


Finally, it seems you also have to configure the 'maxSession' activation configuration property accordingly in your MDB. Default maxSession value is 15. https://docs.jboss.org/ejb3/docs/tutorial/1.0.7/html/Message_Driven_Beans.html

E.g.

  <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>


来源:https://stackoverflow.com/questions/24116222/assign-a-pool-to-a-specific-stateless-bean-in-jboss-eap-6-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!