16.2.5. Assign Bean Pools for Session and Message-Driven Beans
JBoss Administrators can assign individual bean pools for use by session beans and message-driven beans. Bean pools can be assigned by using the Management Console or the CLI tool.
By default two bean pools are provided,
slsb-strict-max-pool
and mdb-strict-max-pool
for stateless session beans and message-driven beans respectively.
To create or edit bean pools, refer to Section 16.2.2, “Create a Bean Pool” and Section 16.2.4, “Edit a Bean Pool”.
Procedure 16.7. Assign Bean Pools for Session and Message-Driven Beans using the Management Console
- Login to the Management Console. Section 3.2.2, “Log in to the Management Console”
- Navigate to the EJB3 Container Configuration panel.
Figure 16.5. EJB3 Container Configuration panel in the Management Console (Standalone Server)
- Click the Edit button. The fields in the Details area are now editable.
- Select the bean pool to use for each type of bean from the appropriate combo-box.
- Click the Save button to keep the changes, or click the Cancel link to discard them.
- The Details area will now be non-editable and display the correct bean pool selection.
Procedure 16.8. Assign Bean Pools for Session and Message-Driven Beans using the CLI
- Launch the CLI tool and connect to your server. Refer to Section 3.3.4, “Connect to a Managed Server Instance Using the Management CLI”.
- Use the
write-attribute
operation with the following syntax./subsystem=ejb3:write-attribute(name="BEANTYPE", value="BEANPOOL")
- Replace BEANTYPE with
default-mdb-instance-pool
for Message-Driven Beans ordefault-slsb-instance-pool
for stateless session beans. - Replace BEANPOOL with the name of the bean pool to assign.
- Use the
read-resource
operation to confirm the changes./subsystem=ejb3:read-resource
Example 16.5. Assign a Bean Pool for Session Beans using the CLI
[standalone@localhost:9999 /] /subsystem=ejb3:write-attribute(name="default-slsb-instance-pool", value="LV_SLSB_POOL") {"outcome" => "success"} [standalone@localhost:9999 /]
Example 16.6. XML Configuration Sample
<subsystem xmlns="urn:jboss:domain:ejb3:1.2"> <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> </subsystem>