16.2.2. Create a Bean Pool

Bean pools can be created using the Management Console and the CLI tool.
Bean pools can also be created by adding the required bean pool configuration to the server configuration file using a text editor. Example 16.2, “XML Configuration Sample” is an example of what this configuration looks like.

Procedure 16.1. Create a bean pool using the Management Console

  1. Login to the Management Console. Refer to Section 3.2.2, “Log in to the Management Console”.
  2. Navigate to the EJB3 Bean Pools panel.
    EJB3 Bean Pools Panel

    Figure 16.2. EJB3 Bean Pools Panel

  3. Click the Add button. The Add EJB3 Bean Pools dialog appears.
  4. Specify the required details, Name, Max Pool Size, Timeout value, and Timeout unit.
  5. Click on the Save button to save the new bean pool or click the Cancel link to abort the procedure.
    • If you click the Save button, the dialog will close and the new bean pool will appear in the list.
    • If you click Cancel, the dialog will close and no new bean pool will be created.

Procedure 16.2. Create a bean pool using the CLI

  1. 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”.
  2. Use the add operation with the following syntax.
    /subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:add(max-pool-size=MAXSIZE, timeout=TIMEOUT, timeout-unit="UNIT")
    • Replace BEANPOOLNAME with the required name for the bean pool.
    • Replace MAXSIZE with the maximum size of the bean pool.
    • Replace TIMEOUT
    • Replace UNIT with the required time unit. Allowed values are: NANOSECONDS, MICROSECONDS, MILLISECONDS, SECONDS, MINUTES, HOURS, and DAYS.
  3. Use the read-resource operation to confirm the creation of the bean pool.
    /subsystem=ejb3/strict-max-bean-instance-pool=BEANPOOLNAME:read-resource

Example 16.1. Create a Bean Pool using the CLI

[standalone@localhost:9999 /] /subsystem=ejb3/strict-max-bean-instance-pool=ACCTS_BEAN_POOL:add(max-pool-size=500, timeout=5000, timeout-unit="SECONDS")  
{"outcome" => "success"}
[standalone@localhost:9999 /]

Example 16.2. XML Configuration Sample

<subsystem xmlns="urn:jboss:domain:ejb3:1.2">

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

</subsystem>