19.3.2. Create a Thread Pool

EJB Thread pools can be created using the Management Console or the CLI.

Procedure 19.9. Create an EJB Thread Pool using the Management Console

  1. Click on Profile in the top right, expand the Container item in the Profile panel on the left and select EJB 3. Then select the Thread Pools tab from the main panel.
    EJB3 Thread Pools Panel

    Figure 19.6. EJB3 Thread Pools Panel

  2. Click the Add button. The Add EJB3 Thread Pools dialog appears.
  3. Specify the required details, Name, Max. Threads, and Keep-Alive Timeout value.
  4. Click on the Save button to save the new thread pool or click the Cancel link to abort the procedure.
    • If you click the Save button, the dialog will close and the new thread pool will appear in the list.
    • If you click Cancel, the dialog will close and no new thread pool will be created.

Procedure 19.10. Create a Thread Pool using the CLI

  1. Launch the CLI tool and connect to your server. Refer to Section 3.5.4, “Connect to a Managed Server Instance Using the Management CLI”.
  2. Use the add operation with the following syntax.
    /subsystem=ejb3/thread-pool=THREADPOOLNAME:add(max-threads=MAXSIZE, keepalive-time={"time"=>"TIME", "unit"=>UNIT"})
    • Replace THREADPOOLNAME with the required name for the thread pool.
    • Replace MAXSIZE with the maximum size of the thread pool.
    • Replace UNIT with the required time unit to be used for the required keep-alive time. Allowed values are: NANOSECONDS, MICROSECONDS, MILLISECONDS, SECONDS, MINUTES, HOURS, and DAYS.
    • Replace TIME with the integer value of the required keep-alive time. This value is a number of UNITs.
  3. Use the read-resource operation to confirm the creation of the bean pool.

Example 19.7. Create a Thread Pool using the CLI

[standalone@localhost:9999 /] /subsystem=ejb3/thread-pool=testmepool:add(max-threads=50, keepalive-time={"time"=>"150", "unit"=>"SECONDS"})
{"outcome" => "success"}
[standalone@localhost:9999 /]

Example 19.8. XML Configuration Sample

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

      <thread-pool name="default" max-threads="20" keepalive-time="150"/>